krypteia-tessera 0.2.0

Shared pure-Rust hash, XOF, MAC and KDF primitives for the krypteia workspace: SHA-1/2/3, Keccak, SHAKE/cSHAKE, RIPEMD-160, BLAKE2/BLAKE3, HMAC, SP 800-185 (KMAC/TupleHash/ParallelHash), the KDF family (HKDF, PBKDF2, SP 800-108, scrypt, Argon2), MGF1 and CRC-16/32. no_std, zero runtime dependencies.
Documentation
// SPDX-License-Identifier: Apache-2.0
// Copyright 2026 Cédric Mesnil <cslashm@pm.me>

//! `krypteia-tessera` — shared pure-Rust hash primitives for the krypteia
//! workspace.
//!
//! One home for every hash, XOF, keyed construction, KDF and checksum the
//! workspace needs — SHA-2, SHA-3 / Keccak, the SHAKE / cSHAKE XOFs, MGF1,
//! the legacy/alt family (SHA-1, RIPEMD-160, BLAKE2b/2s, BLAKE3), HMAC, the
//! SP 800-185 keyed constructions (KMAC, TupleHash, ParallelHash), the KDF
//! family (HKDF, PBKDF2, SP 800-108, scrypt, Argon2) and the
//! non-cryptographic CRC-16/32 checksums — so that `quantica` (post-quantum)
//! and `arcana` (classical) stop carrying their own copies. The granularity
//! (one crate rather than per-family) follows the survey of the Rust
//! crypto ecosystem recorded for v0.2.
//!
//! `no_std`, no runtime dependencies. Constant-timeness is **not** a goal
//! of the hash compression functions themselves (their inputs are public
//! data); secret-dependent comparison/zeroization stays in `silentops`. The
//! memory-hard KDFs process a **secret** password and are **not**
//! constant-time: scrypt (ROMix) and Argon2d/Argon2id use **data-dependent**
//! memory addressing driven by the password (Argon2i is the data-independent
//! variant). This is inherent to the constructions and documented by design,
//! not a defect; see each module's `# Side-channel posture`.
//!
//! # Roadmap (this crate is built in stages)
//!
//! 1. traits ([`Digest`], [`Xof`]) — done.
//! 2. SHA-3: Keccak-f, SHA3-224/256/384/512, SHAKE128/256, cSHAKE — done.
//! 3. SHA-2: SHA-224/256/384/512/512-224/512-256, MGF1 — done.
//! 4. legacy/alt family: SHA-1, RIPEMD-160, BLAKE2b/2s, BLAKE3 — done.
//! 5. quantica migrates onto this crate for Keccak (hot path; benchmarked).
//! 6. arcana migrates onto this crate for SHA-2/SHA-3 and the legacy family.
//! 7. keyed constructions: HMAC, the SP 800-185 family (KMAC, TupleHash,
//!    ParallelHash) — done.
//! 8. KDF family: HKDF, PBKDF2, SP 800-108 (KBKDF) and the memory-hard
//!    scrypt / Argon2 password hashes — done.
//! 9. non-cryptographic CRC-16/32 checksums (no `Digest` impl) — done.

#![no_std]

extern crate alloc;

pub mod argon2;
pub mod blake2;
pub mod blake3;
pub mod crc;
pub mod hkdf;
pub mod hmac;
pub mod mgf1;
pub mod pbkdf2;
pub mod ripemd160;
pub mod scrypt;
pub mod sha1;
pub mod sha2;
pub mod sha3;
pub mod sp800_108;
pub mod sp800_185;
pub mod traits;

pub use argon2::argon2;
pub use blake2::{Blake2b, Blake2s};
pub use blake3::{Blake3, derive_key, hash as blake3_hash, keyed_hash};
// CRC engines + algorithm types. The named parameter-set consts stay under
// `crc::` (e.g. `crc::CRC32_ISO_HDLC`) to keep the crate root uncluttered.
// CRC is a non-cryptographic checksum and deliberately does not impl `Digest`.
pub use crc::{Crc16, Crc16Algorithm, Crc32, Crc32Algorithm};
pub use hmac::{hmac, hmac_multi};
pub use mgf1::mgf1;
// PBKDF2 as a root free fn (mirrors `mgf1`); HKDF's extract/expand/derive stay
// under `hkdf::` because those names are too generic for the crate root.
pub use pbkdf2::pbkdf2;
pub use ripemd160::Ripemd160;
pub use scrypt::scrypt;
pub use sha1::Sha1;
pub use sha2::{Sha224, Sha256, Sha384, Sha512, Sha512_224, Sha512_256};
pub use sha3::{CShake128, CShake256, Sha3_224, Sha3_256, Sha3_384, Sha3_512, Shake128, Shake256};
pub use sp800_185::{
    kmac128, kmac128_xof, kmac256, kmac256_xof, parallelhash128, parallelhash128_xof, parallelhash256,
    parallelhash256_xof, tuplehash128, tuplehash128_xof, tuplehash256, tuplehash256_xof,
};
pub use traits::{Digest, Xof};