Skip to main content
Version: Streamsheets 3.0

CRYPTO.HMAC

Creates an hash based authentication code (HMAC) for given text and secret. The used hash algorithm can be optionally specified. For a list of supported hash algorithms please refer to Hash Algorithms. The used hash algorithms are from the OpenSSL Library. See their docs for more details.

Syntax

=CRYPTO.HMAC(Text, Secret, [Algorithm])

Arguments

NameTypeDescription
TextStringA text to create hash value for.
SecretStringA text used as key to generate the cryptographic HMAC hash.
Algorithm (optional)HashAlgorithmThe hash algorithm to use.

Options:
"blake2b512"
"blake2s256"
"id-rsassa-pkcs1-v1_5-with-sha3-224"
"id-rsassa-pkcs1-v1_5-with-sha3-256"
"id-rsassa-pkcs1-v1_5-with-sha3-384"
"id-rsassa-pkcs1-v1_5-with-sha3-512"
"md4"
"md4withrsaencryption"
"md5"
"md5-sha1"
"md5withrsaencryption"
"mdc2"
"mdc2withrsa"
"ripemd"
"ripemd160"
"ripemd160withrsa"
"rmd160"
"rsa-md4"
"rsa-md5"
"rsa-mdc2"
"rsa-ripemd160"
"rsa-sha1"
"rsa-sha1-2"
"rsa-sha224"
"rsa-sha256"
"rsa-sha3-224"
"rsa-sha3-256"
"rsa-sha3-384"
"rsa-sha3-512"
"rsa-sha384"
"rsa-sha512"
"rsa-sha512/224"
"rsa-sha512/256"
"rsa-sm3"
"sha1"
"sha1withrsaencryption"
"sha224"
"sha224withrsaencryption"
"sha256"
"sha256withrsaencryption"
"sha3-224"
"sha3-256"
"sha3-384"
"sha3-512"
"sha384"
"sha384withrsaencryption"
"sha512"
"sha512-224"
"sha512-224withrsaencryption"
"sha512-256"
"sha512-256withrsaencryption"
"sha512withrsaencryption"
"shake128"
"shake256"
"sm3"
"sm3withrsaencryption"
"ssl3-md5#"
"ssl3-sha1#"
"whirlpool"

Default value: "sha256"

Return

TypeDescription
String or ErrorThe hmac value or an Error Code

Examples

FormulaResultComment
=CRYPTO.HMAC("hello", "top secret")
a28f6aee6a27565bf1b868da1947c35147039fe6482b35d3b8fdeb9592e42e99By default "sha256" is used.
=CRYPTO.HMAC("hello", "top secret", "md5")
9ffaf5da07c95deaa000729cd65fefeaSame text and secret as before but creates an hmac using "md5" algorithm.