public API
Hemera — the complete hash primitive for cyber/core. One sponge. No compression mode. Structured capacity for tree binding.
// ── Sponge API ────────────────────────────────────────────────
// ── Tree API ─────────────────────────────────────────────────
;
;
;
;
;
;
;
;
;
;
;
// ── Batch Proof API ──────────────────────────────────────────
;
;
// ── Sparse Tree API ────────────────────────────────────────────
// ── Convenience ──────────────────────────────────────────────
;
; // = hash(data), constant time
;
// ── Key derivation ────────────────────────────────────────────
;
// ── Permutation ───────────────────────────────────────────────
; // output limbs canonical
; // = permute, constant time
;
// ── Output type ───────────────────────────────────────────────
; // 4 Goldilocks elements, LE canonical
constant time
Every entry point has exactly one of two execution contracts. Both produce the same bits; they differ only in timing behaviour.
constant time — no branch and no memory access depends on the input bytes, the key, or any intermediate field value; only on input lengths and the public round structure:
| entry point | why |
|---|---|
keyed_hash, Hasher::new_keyed |
the key is secret |
derive_key, Hasher::new_derive_key_context, Hasher::new_derive_key_material |
key material is secret |
hash_secret, Hasher::new_secret |
plain-mode digest of secret input (seeds, entropy, private scalars) |
OutputReader from any of the hashers above |
inherits the hasher's mode |
permute_ct |
building block for other secret-input constructions |
A hasher's mode is fixed by its constructor and cannot be changed, so a
caller of the keyed and derive-key APIs cannot reach the fast kernel.
update_traced / finalize_traced are witness generation and are not
constant time in any mode.
fast — everything else: hash, Hasher::new, the tree, batch,
sparse, stream and CDC APIs, permute, permute_batch. These are meant
for public data (content, Merkle nodes and leaves, Fiat–Shamir
transcripts). Their Goldilocks reduction takes a predicted branch when
lo < hi_hi (probability ≈ 2⁻³² per multiplication) — a timing signal
about the data. Hashing a secret with hash is a misuse; use
hash_secret (same digest).
Implementation: the permutation kernel is generic over an arithmetic
backend (rs/src/backend.rs); the constant-time backend takes every
reduction fix-up by csel/mask (hand-written aarch64 assembly;
mask arithmetic in the portable path), field addition and canonical
reduction are mask-based throughout. Checked bit-for-bit against the fast
kernel on 10⁶ random states (rs/tests/constant_time.rs); the compiled
permute_ct was inspected for conditional branches (all on loop
counters) — audit/permutation-performance-2026-10.md §6.