Skip to content

HMAC functions in the Crypto DuckDB extension

Function category

HMAC

1 function

Keyed message authentication codes. Use for signing API requests, verifying message integrity, or building tamper-evident audit trails — anywhere a hash needs a shared secret.

crypto_hmac

Scalar function HMAC
Signature
crypto_hmac( algorithm: VARCHAR, key: VARCHAR, message: VARCHAR ) BLOB
Arguments (Positional)
Argument algorithm Type VARCHAR Mode Positional Description
Argument key Type VARCHAR Mode Positional Description
Argument message Type VARCHAR Mode Positional Description
Description
1 HMAC-SHA256 over a message with a secret key
SELECT lower(to_hex(crypto_hmac('sha2-256', 'my-secret-key', 'important message')));

Output

lower(to_hex(crypto_hmac('sha2-256', 'my-secret-key', 'important message')))
97f324adef061b4ad0abeb6be543913d7db6ba8e6e7f33cd3c4395d619b56df4