Qousio Posted May 10, 2009 Posted May 10, 2009 (edited) Hello! I have noticed theres quite a few people asking how to safely encode/protect passwords or text. My method is far from good, the main purpose is for extra encoding to already encoded text. Although you can use this for just encoding. Heres an example, I made it simple to understand so anybody can alter/expand it. $Message = String("Trying to Xor this text") $Key = 88 $Length = StringLen($Message) $Array = StringToASCIIArray($Message) MsgBox(0, "", "The original ASCII is: " & $Array[0]) For $i = 0 To $Length - 1 Step 1 $Array[$i] = BitXOR($Array[$i], $Key) Next MsgBox(0, "", "The encoded ASCII is: " & $Array[0]) $Chr = Chr($Array[0]) MsgBox(0, "", "The encoded char is: " & $Chr) $Array[0] = BitXOR($Array[0], $Key) $Chr = Chr($Array[0]) MsgBox(0, "", "The decoded char is: " & $Chr) For example, you encoded some text with hashing, randomizing, stringexploding, whatever. Insert the code you got here, and its encoded just a bit more You can run this script multiple times with different keys, aka: For $Key to 0 Step -1 And then reverse it the same way, which will result in a decently encoded text. Here is a working example: #include <Array.au3> $Message = String("Insert your text or encoded text here") $Key = 88 $Length = StringLen($Message) $Array = StringToASCIIArray($Message) Dim $Chr[StringLen($Message)] _ArrayDisplay($Array);This is the original ASCII For $i = 0 To $Length - 1 Step 1 $Array[$i] = BitXOR($Array[$i], $Key) Next _ArrayDisplay($Array);This is the encoded ASCII For $i = 0 To $Length - 1 Step 1 $Chr[$i] = Chr($Array[$i]) Next _ArrayDisplay($Chr);This is the encoded text For $i = 0 To $Length - 1 Step 1 $Chr[$i] = BitXOR($Array[$i], $Key) Next _ArrayDisplay($Chr);This is the decoded ASCII For $i = 0 To $Length - 1 Step 1 $Chr[$i] = Chr($Chr[$i]) Next _ArrayDisplay($Chr);This is the decoded text Edited May 10, 2009 by Qousio
torels Posted May 11, 2009 Posted May 11, 2009 Very Nice... Thanks for sharing Some Projects:[list][*]ZIP UDF using no external files[*]iPod Music Transfer [*]iTunes UDF - fully integrate iTunes with au3[*]iTunes info (taskbar player hover)[*]Instant Run - run scripts without saving them before :)[*]Get Tube - YouTube Downloader[*]Lyric Finder 2 - Find Lyrics to any of your song[*]DeskBox - A Desktop Extension Tool[/list]indifference will ruin the world, but in the end... WHO CARES :P---------------http://torels.altervista.org
Qousio Posted May 11, 2009 Author Posted May 11, 2009 Very Nice... Thanks for sharing I'm glad you liked it
torels Posted May 11, 2009 Posted May 11, 2009 I just have one question now... how come if I add 4 at the Xor's Result (so BitXOR($Array[$i], $Key)+4) during Encryption and Subtract 4 during decryption the string gets messed up ? Some Projects:[list][*]ZIP UDF using no external files[*]iPod Music Transfer [*]iTunes UDF - fully integrate iTunes with au3[*]iTunes info (taskbar player hover)[*]Instant Run - run scripts without saving them before :)[*]Get Tube - YouTube Downloader[*]Lyric Finder 2 - Find Lyrics to any of your song[*]DeskBox - A Desktop Extension Tool[/list]indifference will ruin the world, but in the end... WHO CARES :P---------------http://torels.altervista.org
Qousio Posted May 11, 2009 Author Posted May 11, 2009 I just have one question now... how come if I add 4 at the Xor's Result (so BitXOR($Array[$i], $Key)+4) during Encryption and Subtract 4 during decryption the string gets messed up ? Because you must only change the key, adding 4 to it would just change the bits. For example: Xor 0 1 1 1 1 1 1 1 1 0 1 1 1 0 0 1 Would be: 1 1 0 0 0 1 1 0 Adding 4 to it would be 11001010 However, Xor 0 1 1 1 1 1 1 1 (1 0 1 1 1 0 0 1) + 4 = 10111101 Would be 1 1 0 0 0 1 1 0 Hope that answered your question
UEZ Posted May 11, 2009 Posted May 11, 2009 (edited) _StringEncrypt() is also a simple build-in function (look in the help file). UEZ Edited May 11, 2009 by UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ
Qousio Posted May 11, 2009 Author Posted May 11, 2009 _StringEncrypt() is also a simple build-in function (look in the help file).UEZI know As I mentioned above: "My method is far from good, the main purpose is for extra encoding to already encoded text. Although you can use this for just encoding."So basically you Hash it or StringEncrypt and then run this, double encoding, double the fun =P
torels Posted May 11, 2009 Posted May 11, 2009 Because you must only change the key, adding 4 to it would just change the bits. For example:Xor 0 1 1 1 1 1 1 11 0 1 1 1 0 0 1Would be: 1 1 0 0 0 1 1 0Adding 4 to it would be 11001010However, Xor0 1 1 1 1 1 1 1(1 0 1 1 1 0 0 1) + 4 = 10111101Would be 1 1 0 0 0 1 1 0Hope that answered your question yes thanks a similar thing was done on a bitmap to encode messages in it I believegreat work anyway Some Projects:[list][*]ZIP UDF using no external files[*]iPod Music Transfer [*]iTunes UDF - fully integrate iTunes with au3[*]iTunes info (taskbar player hover)[*]Instant Run - run scripts without saving them before :)[*]Get Tube - YouTube Downloader[*]Lyric Finder 2 - Find Lyrics to any of your song[*]DeskBox - A Desktop Extension Tool[/list]indifference will ruin the world, but in the end... WHO CARES :P---------------http://torels.altervista.org
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now