newLISP Fan Club

Forum => newLISP in the real world => Topic started by: kanen on December 25, 2012, 11:54:16 AM

Title: SHA2 Module
Post by: kanen on December 25, 2012, 11:54:16 AM
Has anyone written an SHA2 module or function that doesn't rely on libcrypto?



I have an MD5 hash function that works, but I'm worried about collisions.



Anyone?
Title: Re: SHA2 Module
Post by: Lutz on December 25, 2012, 01:28:40 PM
You could do a smaller library using those two files:



http://www.opensource.apple.com/source/CommonCrypto/CommonCrypto-7/Source/sha2.c?txt

http://www.opensource.apple.com/source/CommonCrypto/CommonCrypto-7/Source/sha2Priv.h?txt



gcc sha2.c -shared -o sha2.dylib



compiles without a problem on OSX to a sha2.dylib of about 29K
Title: Re: SHA2 Module
Post by: kanen on December 25, 2012, 01:40:00 PM
I'm trying to do this in newLisp, so I don't ever have to rely on a an external library.


Quote from: "Lutz"You could do a smaller library using those two files:



http://www.opensource.apple.com/source/CommonCrypto/CommonCrypto-7/Source/sha2.c?txt

http://www.opensource.apple.com/source/CommonCrypto/CommonCrypto-7/Source/sha2Priv.h?txt



gcc sha2.c -shared -o sha2.dylib



compiles without a problem on OSX to a sha2.dylib of about 29K
Title: Re: SHA2 Module
Post by: kanen on December 25, 2012, 06:01:23 PM
I'm basically thinking of porting this link http://www.movable-type.co.uk/scripts/sha256.html to newLisp.



Unfortunately, I'm waist-deep in Android right now...
Title: Re: SHA2 Module
Post by: hilti on December 26, 2012, 11:36:30 AM
Good idea doing a native newLISP SHA2.



Here's another version written in Common Lisp. Maybe it's another starting point.

//http://common-lisp.net/project/clbuild/mirror/ironclad/sha256.lisp