Compute HMAC-SHA256 hash (string.hmac_sha256)
Declaration
hex_hash = string.hmac_sha256(data, key)
Parameters
- data
string. Input data to hash. - key
string. Secret key used by the HMAC algorithm.
Returns
- hex_hash
string. Lowercase hex text of the HMAC-SHA256 digest.
Description
Use the HMAC-SHA256 algorithm to compute a keyed hash for any string (or binary data).
Example
local signature = string.hmac_sha256('hello world', 'secret')
sys.alert(signature) -- prints "734cc62f32841568f45715aeb9f4d7891324e6d948e4c6c60c0621cdac48623a"
Note: Uses function outside of this chapter: sys.alert