Page 1 of 1

Checksummming in scripts

Posted: Mon Jun 08, 2015 2:00 pm
by Lone_Wolf
Currently Ship Storage Helper doesn't handle store & retrieving ships with shield cycler devices succesfully.
To solve this i am adding methods for storing & retrieving shieldcycler values in JSON format to Shield Cycler oxp.
These methods can be used by any oxp, and i want to verify they were created by SC and not changed after exporting them.

I was thinking of using MD5 checksumming for this, but javascript doesn't appear to have such functionality build in.
I found many implementations of MD5 for node.js, but sofar none for javascript itself.

Cabal Common Library does have a strGetCRC function, but i'm not sure if it's powerful enough to detect small changes.

How do other scripters deal with this ?

Re: Checksummming in scripts

Posted: Mon Jun 08, 2015 2:07 pm
by another_commander

Re: Checksummming in scripts

Posted: Tue Jun 09, 2015 9:52 am
by Svengali
Lone_Wolf wrote:
Cabal Common Library does have a strGetCRC function, but i'm not sure if it's powerful enough to detect small changes.
CCL also ships strEncrypt() and strDecrypt(), but it's not MD5.

Re: Checksummming in scripts

Posted: Tue Jun 09, 2015 12:58 pm
by Lone_Wolf
strEncrypt() and strDecrypt() look useful, though not for checksumming.

another_commander, that link helped a lot.
I have some doubts about the MIT licensing the author uses, as it's based on code that uses BSD license.
I checked the site mentioned, and found http://pajhome.org.uk/crypt/md5/scripts.html .
Downloaded the jshash-2.2 zip file , and found the original code .

I'm looking into adapting the MD5 code to Oolite JS now.
Since this could be useful for other oxpers, i'll create a separate oxp for it which will keep the BSD license.

Re: Checksummming in scripts

Posted: Wed Jun 10, 2015 3:16 pm
by Lone_Wolf
I've read up a bit on compatible licenses, and it is allowed to publish BSD code under several other licenses including MIT & GPL as long as you keep the original copyright notice in the files.

Adapting the code to oolite is more work then i thought and i don't really want to include code with another license then CC in Oolite oxp.
Besides, for my purpose strEncrypt() and strDecrypt() from CCL can do the job.