First thing I have to mention is I'm really really new to Lua and please be patient if you think my question is too dumb
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/hmac
These are the steps I followed
- 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
- 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 doend 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.
EDIT: I'm doing this to get the result. When I include that code the plugin does stops working. I cannot get the output string when I do this
hashvalue = hmac.sha2('key', 'message')
local LrLogger = import 'LrLogger'
myLogger = LrLogger('FlaggedFiles')
myLogger:enable("logfile")
myLogger:trace ("=========================================\n")
myLogger:trace ('Winter is coming, ' .. hashvalue)
myLogger:trace ("=========================================\n")
and the Lightroom refuses to load the plugin and there is nothing on the log as well
Thank you very much for your help