Ukraine flag Armor Games stands with Ukraine Ukraine flag
If you’d like to help, please consider giving to Ukraine Crisis Fund

ForumsProgramming Forum[as3] saving with .sol protection

11 12333
weirdlike
offline
weirdlike
1,299 posts
Prince

Saving is pretty simple stuff

private var saveSlotData:SharedObject;
saveSlotData = SharedObject.getLocal("saveSlotData"

which can be used in a single function

private var saveSlotData:SharedObject = SharedObject.getLocal("saveSlotData"

then you write anything you want, like maybe your cash and lives variable

saveSlotData.data.lives = lives;
saveSlotData.data.cash = cash;

then save the written data and close

saveSlotData.flush();
saveSlotData.close();

getting the data back is simply reversing the above lines but without flush

private var saveSlotData:SharedObject = SharedObject.getLocal("saveSlotData"
lives = saveSlotData.data.lives;
cash = saveSlotData.data.cash;
saveSlotData.close();

---------------------------------------------------------------------------
Now for the encryption key.

There are a few sol editing programs out there, which people use to manipulate local save to have better stats, more money, etc. etc.

I am curious as to other methods that are out there, but a method I have found is by taking all the saved data and generating the MD5 hash and saving the hash alongside the data. Then when the data gets loaded again check the MD5 hash of the data with the stored hash data and if they match, the file is good to go.

first make sure the data is saved

saveSlotData.data.lives = lives;
saveSlotData.data.cash = cash;

then generate the key with the saved data by using the tool

var generatedKey:String = SOLTool.getKey(saveSlotData.data.cash, saveSlotData.data.lives);

you can use as many arguments as you need then save the key with the data

saveSlotData.data.encryptionKey = generatedKey;
saveSlotData.flush();
saveSlotData.close();

at that point when you go to load the data just generate the key again using the same saved data

var newGeneratedKey:String = SOLTool.getKey(saveSlotData.data.cash, saveSlotData.data.lives);

then make the comparison with the saved key

if(newGeneratedKey == saveSlotData.data.encryptionKey)
{
trace("matching&quot
}

if the key does not match then you know that the .sol file has been edited. At that point you can take whatever action you want

You can find my MD5 hash tool HERE just put the class file in the same folder with your other classes and use the above function. Slightly edited by me where everything is compiled into a single class with a single function that uses as many variable's as you want. A current project that I am working on contains 86 variable's all different data.

You can find the full classes for MD5 and SHA 1 hashing, Image encoders, and JSON serialization as well as general String, Number and Date APIs at as3corelib. This will need everything to be put into a string then apply the string to the hash tool and save.

If anyone has a different method, by all means please share, or if there are any questions I can assist in any way to get this working.

  • 11 Replies
Showing 16-15 of 11

We may use cookies to help customize your experience, including performing analytics and serving ads.
Learn More