[**Documentation**](../../../../README)

***

[Documentation](../../../../README) / [@zerotal/core](../../README) / [index](../README) / hmacHex

# Function: hmacHex()

> **hmacHex**(`payload`, `key`): `string`

Defined in: [support/crypto.ts:50](https://github.com/zerotaldev/zerotal/blob/1d6fb26b05b18ba077de1bfaeb46c42131cd8b70/packages/core/src/support/crypto.ts#L50)

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](safeEqual) to
verify — never compare digests with `===`. Use [sha256Hex](sha256Hex) instead when
hashing an unkeyed token for storage.

## Parameters

### payload

`string` \| `Uint8Array`\<`ArrayBufferLike`\>

### key

`string`

## Returns

`string`
