Skip to main content
June 24, 2014
Question

HMAC in Lua - Lightroom plugin devlopment

  • June 24, 2014
  • 1 reply
  • 620 views

Here is my requirement

  • I need to use HMAC-sha256 for Lightroom plugin development as I'm using that for security.

I was trying to use this but with no luck https://code.google.com/p/lua-files/wiki/hmacThese are the steps I followed

  1. Got the code of https://code.google.com/p/lua-files/source/browse/hmac.lua and saved as 'hmac.lua' file in my plugin directory
  2. Got the code from this https://code.google.com/p/lua-files/source/browse/sha2.lua and saved as 'sha2.lua' file

Now in the file I use it like this

local hmac = require'hmac'

local sha2 = require'sha2' 



--somewhere down the line inside a function

local hashvalue = hmac.sha2('key', 'message')

but unfortunately this does not work and I'm not sure what I'm doing wrong. Can anyone advice me what I'm doing wrong here? Or is there an easier and better way of doing this with a good example.

Also I'm doing this to get the returned string

local hashvalue = hmac.sha2( message, key )

myLogger:enable("logfile")

myLogger:trace ("=========================================\n")

myLogger:trace ('Winter is coming, ' .. hashvalue)

myLogger:trace ("=========================================\n")

When I load lightroom it refuses to load the plugin and there is nothing on the log.


Thank you very much for your help

This topic has been closed for replies.

1 reply

areohbee
Legend
July 27, 2014

You also need ffi, bit, and glue - look at the require statements in hmac.lua.