views:

429

answers:

3

I'm running Debian Linux, and for a Lua script I need to create a SHA256 checksum to authenticate requests to Amazon Web Services. They don't say for sure but it looks as if they may want a base64 encoding of the resulting SHA256 checksum.

  • I'd be happy if someone had done a Lua binding.
  • I'd be content if someone could help me figure out how to use the command-line /usr/bin/sha256sum for this purpose.
  • I'd settle for a pointer to C code and deal with the hassle of the binding and the base64 encoding myself.

I surely don't need to reimplement SHA256 for myself; if someone has an implementation in ANSI standard C that they like, please let me know. Or a better solution!

+2  A: 

It looks like mushclient has already written a Lua wrapper for a SHA-256 library.

Martin v. Löwis
Unfortunately this only does a SHA256 digest, not the HMAC signing I'm looking for. I wound up writing the binding myself from somebody's reference implementation. But +1 for the pointer to mushclient, because it's good for us all to know about.
Norman Ramsey
+2  A: 

How about LuaCrypto, a front-end for OpenSSL:

http://luacrypto.luaforge.net/

uroc
Perfect! Where were you Saturday? :-)
Norman Ramsey
A: 

A work-around might be the free signing service at http://apisigning.com/

Brandon