Jump to content

An attempt to encypt a file using _StringEncrypt but with a twist


Recommended Posts

Hi all,

For a while I've been looking for a function to encrypt and decrypt files, I looked at MD5 and various other UDF's, but really they where to complex for me. So I settled on writting a file with a unique file extension and writting everything to it after it's been through _StringEncrypt using the same password each time (Set by a varible). I.E

#include <String.au3>

$EncyptionPassword = "password"
$EncyptedText = _StringEncrypt(1, "This text is encypted", $EncyptionPassword) & "|" & _StringEncrypt(1, "And I want to split it", $EncyptionPassword)
Filewrite("UniqueExtension.ue", $EncyptedText & @LF)

Which works fine, but the problem lays when I try to read it...

I need to decypt the text, read it, then split it - this is what I've got so far...

$fopen = FileOpen("UniqueExtension.ue")
While 1
$LINE = FileReadLine($fopen)
$dctext = _StringEncypt(0, $LINE, $EncyptionPassword);which should return "This text is encypted|And I want to split it"
Dim $Split = StringSpilt($dctext, "|", 2)
MsgBox(0, "$Split results", $Split[0] &  "  -  " & $Split[1]) ;which should return "This text is encypted  -  And I want to split it"
WEnd

...But the message box does return what it should do, instead "This text is encypted - " Then the other part is still encypted!

Any Idea's?

PS I Will still work on it!

Link to comment
Share on other sites

DAMM IT...sorry guys.

As I was writting the script on the post I thought of a solution and it worked!

I Just chanaged $EncyptedText to _StringEncrypt(1, "This text is encypted|And I want to split it", $EncyptionPassword) then I changed StringSplit to method 2, now it works!

Sorry for wasting anyones time and a topic

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...