Skip to main content
zerotal

Documentation


Documentation / @zerotal/core / index / hmacHex

Function: hmacHex()

hmacHex(payload, key): string

Defined in: support/crypto.ts:50

HMAC-SHA256 of payload under key, hex-encoded. Synchronous, via Bun.CryptoHasher.

The canonical helper for keyed signing across the framework (signed URLs, snapshot checksums, signed upload paths). Pair it with safeEqual to verify — never compare digests with ===. Use sha256Hex instead when hashing an unkeyed token for storage.

Parameters

payload

string | Uint8Array<ArrayBufferLike>

key

string

Returns

string