erebus Posted November 11, 2004 Share Posted November 11, 2004 Hello all, I have written two scripts where the first writes some game CD keys to an ini file as values and the second one reads them. The problem is that while the .ini file is located in an SMB Windows share folder, can be manually read by everyone in the LAN since the CD key values are human readable. Can someone throw me a bone of how to achieve a (basic) encryption/decryption for these values to avoid this issue? Hint1: CD key format example: a. HJ7MVH-EKZ9-BVM6Z6-FYDX-CMGTBG (Warcraft III) b. RV9VEM-7T67-6H7C8E-K7WD-JBHCE2 (Frozen Throne) Hint2: The idea is to use the encryption, not the hidden windows' shares. Thanks in advance for your time.. Link to comment Share on other sites More sharing options...
ezzetabi Posted November 11, 2004 Share Posted November 11, 2004 What about a Rot-13? It is easy to implement, but weak. It is enough for you? Otherwiseuse the idea.com scripts. Link to comment Share on other sites More sharing options...
CyberSlug Posted November 11, 2004 Share Posted November 11, 2004 You could instead/additionaly re-order the sections of the key: ; PLAIN TEXT $cdkey = "EXMPL-CDKEY-GOES0-HERE0-12345" $key = StringSplit($cdkey, "-") ; ENCRYPTING $encrypted = $key[2] & $key[5] & $key[1] & $key[4] & $key[3] ; this stores CDKEY-12345-EXMPL-HERE0-GOES0 ;..... ; DECRYPTING $d = StringSplit($encrypted, "-") $decrypted = $d[3] & $d[1] & $d[5] & $d[4] & $d[2] Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig! Link to comment Share on other sites More sharing options...
ezzetabi Posted November 11, 2004 Share Posted November 11, 2004 Sweet. Link to comment Share on other sites More sharing options...
erebus Posted November 11, 2004 Author Share Posted November 11, 2004 (edited) @CyberSlug: This is a good idea, however someone can easily image the trick if manages to see the ini file. I 've also thought of reversing some of the splitted strings, but it makes no difference; it's too weak.@ezzetabi: Thanks for the tip, I was totally unaware of the ROT13 method. However as I checked a bit, it's a game for someone to break it (check the online tool @ http://www.rot13.com for instance).Searching the AutoIT forums I found your two great ROT13 functions in an old post. If we take the CyberSlug's function as an example (which code seems more compact) could we alter it in an easy way to customize the ROT13 encryption?Correct me if I am wrong but I think that this kind of encryption is based on numbers. By using total different numbers in the function (or even better a passphrase) don't we achieve a new encryption method (assuming that the new encryption source code is unavailable)?Thank you. Edited November 11, 2004 by erebus Link to comment Share on other sites More sharing options...
Mr.Wizard Posted November 11, 2004 Share Posted November 11, 2004 Try this: Opt("MustDeclareVars", 1) dim $notencrypted = "HJ7MVH-EKZ9-BVM6Z6-FYDX-CMGTBG (Warcraft III)" dim $encrypted = encdec($notencrypted) dim $decrypted = encdec($encrypted) MsgBox(0, "xor encryption test", "before encryption: " & $notencrypted & @crlf & @crlf & "after encryption: " & $encrypted & @crlf & @crlf & "after decryption: " & $decrypted) Func EncDec($original) dim $modified dim $key = "I am the magic key" dim $pos_original, $pos_key For $pos_original = 1 To StringLen($original) If $pos_key = StringLen($key) Then $pos_key = 1 Else $pos_key = $pos_key + 1 EndIf $modified = $modified & Chr(BitXOR(Asc(StringMid($original, $pos_original, 1)), Asc(StringMid($key, $pos_key, 1)), 255)) Next Return $modified EndFunc I have a catapult. Give me all the money or I will fling an enormous rock at your head. Link to comment Share on other sites More sharing options...
ezzetabi Posted November 11, 2004 Share Posted November 11, 2004 Check here.http://www.autoitscript.com/forum/index.php?showtopic=2611Using idea.com and this sample code you should not have problems. Do the following.Encrypt the file,Make a script the decrypt, read the .ini encrypt again.Enjoy. Link to comment Share on other sites More sharing options...
erebus Posted November 11, 2004 Author Share Posted November 11, 2004 @ezzetabi: I really like the way you code pal. This is another excellent idea, thank you very much! @Mr.Wizard: Great functions too, thanks a lot for your time. Amazing results! Link to comment Share on other sites More sharing options...
JSThePatriot Posted November 11, 2004 Share Posted November 11, 2004 Hey... I just created a program that will use AxCrypt (look on sourceforge for it) that will automatically encrypt files. I think AxCrypt would be what you are looking for as you can have AutoIt automate it. It has command line parameters. Once I get home I will give you the web address and such if you are interested. I will be posting my script in the scripts and scraps section once it is finished. JS AutoIt Links File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out. ComputerGetInfo UDF's Updated! 11-23-2006 External Links Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more) Link to comment Share on other sites More sharing options...
erebus Posted November 13, 2004 Author Share Posted November 13, 2004 Thank you very much, I 've already used Mr.Wizard's solution so as to use something quick and handy. I would like to see your adaptation with AxCrypt, it should be very interesting! Link to comment Share on other sites More sharing options...
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