OxL Reference

data hmac

HMAC (RFC 2104): hmac.sha256(key, message).

Example:

oxl✓ checked in CI
use std.crypto { hmac }
use std.ser { bytesOf, hex }

fn main() io {
  print(hex(&hmac.sha256(bytesOf(&"key"), bytesOf(&"The quick brown fox jumps over the lazy dog"))))
}
Output
f7bc83f430538424b13298e6aa6fb143ef4d59a14946175997479dbc2d1a3cd8
pub(api) data hmac

Thread safety. pure functions; safe from any task.

Since. 1.0.0-beta

Methods

sha256(key: bytes, input: bytes) -> bytes
HMAC-SHA-256 of input under key (32 bytes).
sha384(key: bytes, input: bytes) -> bytes
HMAC-SHA-384 of input under key (48 bytes).
sha512(key: bytes, input: bytes) -> bytes
HMAC-SHA-512 of input under key (64 bytes).

Defined in: std/crypto/crypto.oxl:202

See also