Hash.hmac256
Calculates the HMAC-SHA256 of a Bytes.Bytes or Hex.Hex value.
This function is a re-export of hmac from @noble/hashes, an audited & minimal JS hashing library.
Imports
Named
import { Hash } from 'ox'Examples
import { Hash, Hex } from 'ox'
Hash.hmac256(Hex.fromString('key'), '0xdeadbeef')
'0x...'Configure Return Type
import { Hash, Hex } from 'ox'
Hash.hmac256(Hex.fromString('key'), '0xdeadbeef', { as: 'Bytes' })
Uint8Array [...]Definition
function hmac256<value, as>(
key: Hex.Hex | Bytes.Bytes,
value: value | Hex.Hex | Bytes.Bytes,
options?: hmac256.Options<as>,
): hmac256.ReturnType<as>Source: src/core/Hash.ts
Parameters
key
- Type:
Hex.Hex | Bytes.Bytes
Bytes.Bytes or Hex.Hex key.
value
- Type:
value | Hex.Hex | Bytes.Bytes
Bytes.Bytes or Hex.Hex value.
options
- Type:
hmac256.Options<as> - Optional
Options.
options.as
- Type:
"Bytes" | "Hex" | as - Optional
The return type.
Return Type
HMAC-SHA256 hash.
hmac256.ReturnType<as>

