SHA-0.3.zip includes a Maple archive and help data base that implement the SHA algorithm (SHA-1, SHA-224, SHA-256, SHA-384, and SHA-512).  The implementation is interpreted Maple, so will be considerably slower than a compiled routine, but these should be fast enough for likely uses in Maple.  For example

CodeTools:-Usage(SHA("The quick brown fox jumps over the lazy dog", 512));
memory used=502.00KiB, alloc change=255.95KiB, cpu time=12.00ms, real time=12.00ms
"07e547d9586f6a73f73fbac0435ed76951218fb7d0c8d788a309d785436bbb642e93a252a954f23912547d1e8a3b5ed6e1bfd7097821233fa0538f3db854fee6"

Addendum
To facilitate inspecting the code, I've included the source in the zip file. While doing so, corrected a minor bug that  only affects SHA 384 and SHA512 if message is longer than 2^32 bits (good luck with that 8-).

Second Addendum
Fixed a bug.  Verified all algorithms on all test vectors that are part of the standard.  Added a 'hexstring' option to allow hexadecimal string representations as input.  That is needed to permit thorough testing since the 0 byte cannot be represented as a character in a string.


Please Wait...