Back to product page

HMAC method

Calculates Keyed Hash Message Authentication Code of data in the blob.




  • Basic
object.HMAC Data, OutBlob
The HMAC(object,Data,OutBlob) syntax has these parts:
objectAn expression evaluating to an object of type wodCrypt.
DataRequired. A Blob object. Contains data to be digested.
OutBlobRequired. A Blob object. Fixed-size digest result.


The HMAC method will take an existing Data Blob and combine it your SecretKey to calculate the digest value. The result will be stored to OutBlob initialized by your program. The resulting Blob will *always* contain 16/20/32/48/64 bytes, depending on whether MD5, SHA1, SHA256, SHA384 or SHA512 algorithm type is used..

To provide some background theory, a hash/HMAC function is a transformation that takes a variable size input and your secret key, and returns a fixed size byte array/string. A hash function is said to be one-way, because it is hard to invert it - meaning it's almost impossible to determine the original data from it's hashed equivalent. HMAC is different than regular MAC/Digest because it includes your secret key in the data, so that part of the digest always depends on the secret only person that generates it knows.