SHA1 implemented in Lua

This is a SHA1 implementation for LuaJIT. Take a look at the source for example usage and documentation.

The performance is decent considering this is written in a scripting language but I appreciate any ideas for improving the speed (loop unrolling?). In my benchmarks this version appears to be around 3.6 times slower than the OpenSSL assembly language version on my Q9550 (tested in Linux; hashing about 2GB of data).

[Download Lua SHA1 source]

The benchmark script I use just reads from stdin and prints out the SHA1 hash. I generally only use the 32-bit version of LuaJIT due to its greater memory capacity.

[Download SHA1 benchmark script]

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *