Arterie Posted July 14, 2009 Posted July 14, 2009 (edited) Maybe i dont see the forest for the trees. Maybe you could take a look at this code. The StringTrimLeft(....,16) comes from the fact, that the numbers 1-5 which are my random encrypting levels are always 16 digits long, on lvl 3. #include <String.au3> save(500,"Test","Money") MsgBox("","",load("Test","Money")) Func save($Value,$Player,$Section) $Level = Random(1,5) $temp = _StringEncrypt(1,$Level,"123456",3) IniWrite("tempdata.ini",$Section,$Player,$temp & _StringEncrypt(1,$Value,"123456",$Level)) Return 1 EndFunc Func load($Player,$Section) $String = IniRead("tempdata.ini",$Section,$Player,0) $TrimLen = StringLen($String) - 16 $Level = _StringEncrypt(0,StringTrimRight($String,$TrimLen),"123456",3) $Value = _StringEncrypt(0,StringTrimLeft($String,16),"123456",$Level) ;$Value = Number($Value) Return $Value EndFunc Edited July 14, 2009 by Arterie
dantay9 Posted July 14, 2009 Posted July 14, 2009 (edited) Not terrible for a first timer. You have a general idea. If you are looking for some excellent examples from the real world, take a look at Crypto Suite. Edited July 14, 2009 by dantay9
Arterie Posted July 14, 2009 Author Posted July 14, 2009 Ok, thanks. But i still want this little script wokring..
Moderators SmOke_N Posted July 14, 2009 Moderators Posted July 14, 2009 On 7/14/2009 at 5:41 PM, 'Arterie said: Ok, thanks. But i still want this little script wokring..Did you ever check the value of Random()? It generates a 256 char len for me because of the decimal:Instead of: Random(1,5)Try: Random(1,5, 1) Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
dantay9 Posted July 14, 2009 Posted July 14, 2009 Try this: Encrypt(500, "TEST", "Money") ConsoleWrite(Decrypt("TEST", "Money") & @CRLF) Func Encrypt($Value, $Section, $Player) $Level = Random(1, 5, 1) $temp = _StringEncrypt(1, $Level, "123456", 3) $temp2 = _StringEncrypt(1, $Value, "123456", $Level) IniWrite("tempdata.ini", $Section, $Player, $temp2) IniWrite("tempdata.ini", $Section, $Player & "Level", $temp) Return 1 EndFunc ;==>Encrypt Func Decrypt($Section, $Player) $Level = _StringEncrypt(0, IniRead("tempdata.ini", $Section, $Player & "Level", ""), "123456", 3) $Value = _StringEncrypt(0, IniRead("tempdata.ini", $Section, $Player, ""), "123456", $Level) Return $Value EndFunc
Arterie Posted July 14, 2009 Author Posted July 14, 2009 Ok with Random(1,5, 1) it works fine now. Thank you!
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