An open API service indexing awesome lists of open source software.

https://github.com/wojtekb30/fibaro-lua-hmac_sha256

Pure LUA 5.2 implementation of HMAC_SHA256 algorithm, works in Fibaro Home Center 3.
https://github.com/wojtekb30/fibaro-lua-hmac_sha256

authentication-backend fibaro fibaro-hc3 fibaro-home-center hmac-authentication hmac-sha256 lua

Last synced: about 2 months ago
JSON representation

Pure LUA 5.2 implementation of HMAC_SHA256 algorithm, works in Fibaro Home Center 3.

Awesome Lists containing this project

README

        

# Fibaro-HMAC_SHA256
Pure LUA 5.2 implementation of HMAC_SHA256 algorithm, works in Fibaro Home Center 3. Also contains code for generating SHA256 of a string.

Paste the code into your LUA 5.2 script or Fibaro HC3 LUA scene, and then use hmac_sha256() function to have the string encrypted with HMAC_SHA256. Or use sha256() to generate SHA256 of a string.

Useful for making API calls, for example those with Tuya API. HMAC_SHA256 is used in authentication.

Usage example for hmac_256 (assuming the whole function code was copied and pasted into the script):

local client_id = "abc"

local secret = "abcdefgh"

local timestamp = "123" --Current time in miliseconds

local nonce = "456abce" --Random value like Python os.urandom(16) would return

local message = client_id .. timestamp .. nonce

print("Message:", message)

local signature = hmac_sha256(secret, message) --first key, then content, both strings

print("Generated Signature:", signature)