Module: crypto.hmac
Source: ./crypto/hmac.reef
Overview
crypto/hmac - HMAC (Hash-based Message Authentication Code)
Implements HMAC (RFC 2104) for MD5, SHA-1, and SHA-256. HMAC provides message authentication using a secret key.
Usage: import crypto.hmac let mac = hmac_sha256("key", "message") let mac = hmac_md5("key", "message") let mac = hmac_sha1("key", "message")
Functions
fn hmac_hex_nibble(c: int): int
fn hmac_str_to_bytes(s: string): [uint8]
Copy a string's bytes into a [byte] buffer (up to str.length — the string API boundary; all binary intermediates below stay in [byte]).
fn hmac_hex_to_byte_array(hex: string): [uint8]
Decode a hex string to its raw bytes. Binary-safe: the result may legally contain 0x00 bytes (that is the whole point of this fix).
fn hmac_pad_key_bytes(kb: [uint8], block_size: int): [uint8]
Zero-padded key block of exactly block_size bytes.
fn hmac_xor_block(block: [uint8], pad_byte: int): [uint8]
XOR every byte of a block with pad_byte, returning a new block.
fn hmac_concat_bytes(a: [uint8], b: [uint8]): [uint8]
Concatenate two byte buffers (length-delimited, NUL-safe).
fn hmac_md5(key: string, message: string): string
fn hmac_sha1(key: string, message: string): string
fn hmac_sha256(key: string, message: string): string
Generated by reefc doc