Safe Save

by Garthor
Protects savefiles from being tampered with [More]
To download this library for your Linux/Mac installation, enter this on your command line:

DreamDownload byond://Garthor.SafeSave##version=2

Emulator users, in the BYOND pager go to File | Open Location and enter this URL:

byond://Garthor.SafeSave##version=2

498 downloads
Version 2
Date added: Jan 12 2010
Last updated: Jan 13 2010
7 fans
The purpose of this library is to use an md5() hash to secure a savefile from tampering,
in a manner which is not trivially circumvented.


This library defines three new procs:

safe_save(var/savefile/F, var/name)
Creates a new, protected savefile with the specified name from F.
Returns the newly-created, protected savefile.
The savefile F is left unmodified.

safe_load(var/savefile/F)
Creates a new savefile from the protected savefile F (created using safe_save()).
Returns the un-protected savefile, for reading.
The returned savefile can be read as normal, and is created as a temporary savefile.
Will return null if the savefile has been found to be tampered with.

make_hash(var/text)
Creates a hash from a text string. By default, will simply return md5("[world.hub_password][text]").
Should be overridden to use a more unique salt, if you do not feel that your hub password is secure.

Comments

Ganing: (Feb 22 2012, 5:14 am)
Hey Garthor, I think you should check this out. This is causing some internal errors with BYOND. Lummox explained it but I really did not understand it.

http://www.byond.com/forum/?post=318642