hmac
hmac<
THashReturnArrayBuffer>(hash,blockSizeBytes,key,message,tagLengthBytes?):Uint8Array<THashReturnArrayBuffer>
Defined in: hmac-core.ts:21
HMAC (RFC 2104 / FIPS 198-1): a keyed-hash message authentication code built
from any hash function and its compression function’s block size — both
supplied explicitly by the caller (e.g. hmac(sha256Ts, 64, key, message)),
matching every other block-size-parametrized primitive in crypto/hash
(merkleDamgardPad) rather than a hash-algorithm registry; the caller owns
algorithm specificities.
Type Parameters
Section titled “Type Parameters”THashReturnArrayBuffer
Section titled “THashReturnArrayBuffer”THashReturnArrayBuffer extends ArrayBufferLike
Parameters
Section titled “Parameters”(data) => Uint8Array<THashReturnArrayBuffer>
A one-shot, synchronous hash function — the TS kernel of
whichever algorithm the caller has chosen (e.g. sha256Ts), never the
Web-Crypto-preferring dual kernel, since that one’s Promise-returning
shape doesn’t fit HMAC’s handful of nested synchronous calls.
blockSizeBytes
Section titled “blockSizeBytes”number
hash’s compression function’s block size — 64 for
MD5/SHA-1/SHA-224/SHA-256, 128 for SHA-384/SHA-512.
Uint8Array
message
Section titled “message”Uint8Array
tagLengthBytes?
Section titled “tagLengthBytes?”number
Truncates the returned tag to this many bytes (RFC 2104 §5). Defaults to the full untruncated output.
Returns
Section titled “Returns”Uint8Array<THashReturnArrayBuffer>