ID:134904
 
Is it possible to make a client file that can be used on one serv and then another one? Tell me if so so i dont waste my time working after nothing... and if its possible...then encryption...crap...
Thats..why its called..Client Side Saving...
In response to Sniper Joe (#1)
thx... befor i actually looked, a shortcut..
Lou wrote:
and if its possible...then encryption...crap...

Ok. Basic savefile protection is easy.
The first step is to understand the md5() proc. It's pretty easy, you give it a file or text string, then it returns a hash string.
So this example would create a hash for the text string "I like books".
mob/verb/test()
var/hash = md5("I like books")
world << "[hash]"


Now that doesn't appear to useful, because you can't turn a hash back into the original text string. However if you'll always get the same hash from the same string.
Thanks to this we're able to check to see if data bas been modified.

Take this example:
mob/verb/test2()
var/hash1 = md5("[src.name] likes books!")
world << "[hash1]"
src.name = input("Choose a new name, or reuse your current one") as text
var/hash2 = md5("[src.name] likes books!")
world << "[hash2]"
if(hash1 != hash2)
world << "The name was changed between encryptions!"


If you use a new name, the hashes wont be the same and you'll get a message.

To apply this to savefiles, we just make sure to save the hash of "[stat1][stat2]randomword" along with all our stats. Then when the file is loaded we use the stats loaded from the savefile to make a new has using the same formula.
If the hash matches the saved hash then stat1 and stat2 haven't been modified. If it doesn't then someone has tampered with the savefile.
The player will be able to edit the file all they want, but they wont be able to figure out the correct hash to use for those stats so when it's loaded you'll be able to tell they're fake.
Of course you have to make sure that you put all the vars that you don't want people tampering with into the MD5 string.