uce/site/doc/pages/hmac_sha256_hex.txt
2026-06-16 23:02:45 +00:00

20 lines
517 B
Plaintext

:sig
String hmac_sha256_hex(String key, String data)
:params
key : secret key
data : message to authenticate
return value : the HMAC-SHA256 as a 64-character lowercase hex string
:content
Computes an HMAC-SHA256 message authentication code and returns it as hex. Use it to sign tokens, cookies, and webhook payloads, then verify with `crypto_equal()` to avoid timing leaks.
:example
print(hmac_sha256_hex("key", "The quick brown fox jumps over the lazy dog"), "\n");
:see
>sys
hmac_sha256
sha256_hex
crypto_equal