crypto.hmac_sha256
crypto.hmac_sha256
Function
Generate an HMAC-SHA256 signature of the current text using the key.
Syntax
crypto(text).hmac_sha256(key)
Parameters
| Parameters | Type | Required | Default value | Description |
|---|---|---|---|---|
| key | String | Yes | None | HMAC key. |
Return value
| Type | Description |
|---|---|
| String | HMAC-SHA256 lowercase hexadecimal signature. |
Code Example
result = crypto('payload').hmac_sha256('secret') // Output: b82fcb791acec57859b989b430a826488ce2e479fdf92326bd0a2e8375a42ba4 print result
Notes
- Both text and keys participate in the calculation as UTF-8 bytes.