Lua binding for the SHA-256/384/512 BSD-licensed C implementation by Aaron Gifford[1].
Also contains the generic HMAC implementation per rfc2104 plus HMAC-SHA256/384/512 variants, and HMAC-MD5 (requires md5).
* v0.2 (beta quality) * for Lua 5.1 * SHA tested with original test vectors on Win32 and 32bit and 64bit Linux * HMAC-SHA tested with rfc4231 test vectors on Win32 and 32bit and 64bit Linux
* v0.2 - (26 Nov 2010) added HMAC modules and hex output variants * v0.1 - (24 Nov 2010) initial release
* Windows 32bit / binary * `>luarocks install http://sha2.googlecode.com/hg/sha2-0.2.0-1.win32-x86.rock`
* Windows 32bit / VC++, using `LuaRocks` * copy [http://msinttypes.googlecode.com/svn/trunk/inttypes.h inttypes.h] to your VC++ include dir * open up a VC++ command-line environment * `>luarocks install http://sha2.googlecode.com/hg/sha2-0.2.0-1.rockspec`
* Windows 32bit / minGW * checkout the sources: `>hg clone https://sha2.googlecode.com/hg/ sha2` * edit `build-mingw.bat` and change LUA_INC and LUA_LIB * `>build-mingw.bat` * copy `sha2lib.dll` somewhere in your `package.cpath`
After installation, please run `test_sha2.lua` and `test_hmac.lua` (the later needs `LuaSocket` and `md5`).
* if a function is passed instead of a string, it will be called repeatedly and it's output will be consumed until it returns nil or nothing (that is, make it work with a LTN12 source). * have it put in the main LuaRocks repository. * talk about merging with md5 library.
* `[email protected]` * feedback welcome! use the Issues tab for bug reporting, thanks!
* [http://lua-users.org/wiki/SecureHashAlgorithm SHA256 in pure-Lua], for Lua 5.2, using the new bit32 built-in library * [http://www.gammon.com.au/mushclient/mushclient.htm mushclient] contains a wrapper of a GPL'ed C implementation * [http://luacrypto.luaforge.net/ LuaCrypto] can do SHA-2 as it binds to OpenSSL (not tested) * [http://www.eder.us/projects/lcrypt/ lcrypt] can do SHA-2 as it binds to [http://libtom.org/ LibTom] (not tested) * [http://www.tecgraf.puc-rio.br/~lhf/ftp/lua/#lmd5 lmd5] can do SHA-2 as it binds to OpenSSL (not tested) * [http://lua-users.org/files/wiki_insecure/users/tnodir/ luamhash] can do SHA-2 as it binds to [http://mhash.sourceforge.net/ mhash] (not tested; Lua 5.0)