How to use HMAC in Lua - Lightroom plugin

♀尐吖头ヾ 提交于 2019-12-04 09:27:00

I'd first make sure your code works outside of Lightroom. It seems that HMAC module you referenced has some other dependencies: it requires "glue", "bit", and "ffi" modules. Of these, bit and ffi are binary modules and I'm not sure you will be able to load them into Lightroom (unless they are already available there). In any case, you probably won't be able to make it run in LR if you don't have required modules and can't make it run without issues outside of LR.

If you just need to get SHA256 hash there is a way to do it Lightroom

I posted my question here and was able to get an answer. But there there was no reference of this on SDK documentation (Lightroom SDK)

local sha = import 'LrDigest'
d = sha.SHA256.digest ("Hello world")

but unfortunately there was no HMAC so I decided to use md5 with a salt because this was taking too much of my time

Spent quite some time trying to find a solution :-/ LrDigest is not documented, thanks Adobe! Solution:

local LrDigest = import "LrDigest"
LrDigest.HMAC.digest(string, 'SHA256', key)
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!