I have installed lua-resty-hmac and luacrypto from luarocks and want to perform encryption using hmac and sha1 in Lua. I have gone through the following thread How to use HMAC in Lua - Lightroom plugin. I am trying the following
local hmac = require'hmac'
local sha2 = require'sha2'
local hashvalue = hmac.sha2('key', 'message')
But when I execute this I get the following error -
lua: /home/agile/Music/works/Lua/lua-resty-hmac-master/lib/resty/hmac.lua:4: module 'crypto' not found:
no field package.preload['crypto']
no file './crypto.lua'
no file '/usr/share/lua/5.1/crypto.lua'
no file '/usr/share/lua/5.1/crypto/init.lua'
no file '/usr/lib64/lua/5.1/crypto.lua'
no file '/usr/lib64/lua/5.1/crypto/init.lua'
no file '/home/agile/Music/works/Lua/lua-resty-hmac-master/lib/resty/crypto.lua'
no file './crypto.so'
no file '/usr/lib64/lua/5.1/crypto.so'
no file '/usr/lib64/lua/5.1/loadall.so'
stack traceback:
[C]: in function 'require'
/home/agile/Music/works/Lua/lua-resty-hmac-master/lib/resty/hmac.lua:4: in main chunk
[C]: in function 'require'
3.lua:2: in main chunk
[C]: ?
Please suggest where I am doing wrong.