Expand description
oxicrypto – Pure Rust cryptography facade for the OxiCrypto stack.
§Feature flags
| Flag | Default | Description |
|---|---|---|
pure | on | Enables all pure-Rust sub-crates (hash, aead, mac, sig, kex, kdf, rand). |
std | off | Propagates std features to subcrates. |
simd | off | Enables explicit runtime CPU-feature detection (AES-NI, SHA-NI, AVX2, NEON). Exposes oxicrypto::simd::cpu_info(). The underlying RustCrypto crates already perform runtime dispatch via cpufeatures internally; this flag makes it visible and testable. |
pq-preview | off | Post-quantum preview: ML-KEM (FIPS 203) + ML-DSA (FIPS 204). |
With default-features = false on this crate, only the trait surface from
oxicrypto-core is available; no algorithm implementations are included.
§Runtime feature introspection
Use enabled_features() at runtime to see which features were compiled in.
Use available_algorithms() to enumerate all algorithms available in the current build.
§Feature flag algorithm matrix
| Feature | Algorithms |
|---|---|
pure (default) | AES-GCM-128/256, ChaCha20-Poly1305, AES-CCM-128/256, AES-GCM-SIV-128/256, XChaCha20-Poly1305, AES Key Wrap 128/256; HMAC-SHA2-256/384/512, HMAC-SHA3-256/512, CMAC-AES128/256, KMAC128/256, Poly1305; SHA-256/384/512, SHA3-256/384/512, BLAKE3; Ed25519, Ed448, ECDSA P-256/384/521, RSA PKCS1v15/PSS (SHA-256/384/512); X25519, ECDH P-256/384/521; HKDF-SHA256/384/512, Argon2id, PBKDF2-SHA256/512, scrypt |
pq-preview | ML-KEM-512/768/1024 (FIPS 203), ML-DSA-44/65/87 (FIPS 204), SLH-DSA (all 10 param sets — SHA2/SHAKE × 128s/128f/192s/192f/256s/256f, FIPS 205), X-Wing hybrid KEM |
simd | Explicit runtime SIMD dispatch via simd::cpu_info() (AES-NI, SHA-NI, AVX2, NEON) |
std | Propagates std feature to all sub-crates (thread-local RNG, etc.) |
Re-exports§
pub use version::available_algorithms;pub use version::enabled_features;pub use version::version;pub use version::Suite;pub use version::VersionInfo;pub use algo::*;
Modules§
- algo
- Algorithm selector enums and factory functions.
- cipher
- Raw single-block / stream cipher primitives (AES-ECB block, ChaCha20 keystream) used by QUIC header protection (RFC 9001 §5.4). These are low-level building blocks, distinct from the authenticated AEAD ciphers.
- hpke
- Hybrid Public Key Encryption (HPKE) — RFC 9180.
- prelude
- Convenient re-exports of the most commonly used traits and enums.
- version
- Version information and algorithm enumeration for the
oxicryptofacade.
Structs§
- AesGcm
Siv128 - AES-128-GCM-SIV authenticated encryption (misuse-resistant).
- AesGcm
Siv256 - AES-256-GCM-SIV authenticated encryption (misuse-resistant).
- Argon2
Params - Parameters for Argon2id key derivation.
- Argon2id
Stretch Params - Parameters for the Argon2id stretching backend.
- Balloon
Hasher - A Balloon password hasher bundling its variant and cost parameters.
- Balloon
Params - Cost parameters for Balloon hashing.
- Balloon
Stretch Params - Parameters for the Balloon-SHA-256 stretching backend.
- Deoxys2_
128 - Deoxys-II-128-128 authenticated encryption (nonce-misuse resistant).
- Ecdh
P256 - ECDH key agreement over NIST P-256 (secp256r1).
- Ecdh
P384 - ECDH key agreement over NIST P-384 (secp384r1).
- Ecdsa
P256 Signer - ECDSA P-256 signing key.
- Ecdsa
P256 Verifier - ECDSA P-256 verifying key.
- Ecdsa
P384 Signer - ECDSA P-384 signing key.
- Ecdsa
P384 Verifier - ECDSA P-384 verifying key.
- Ecdsa
P521 Signer - ECDSA P-521 signing key.
- Ecdsa
P521 Verifier - ECDSA P-521 verifying key.
- Ed448
Signing Key - Ed448 signing key.
- Ed448
Verifying Key - Ed448 verifying key.
- Hash
Builder - Fluent builder producing a boxed one-shot
Hashinstance. - Hkdf
Sha384 - HKDF-SHA-384 key derivation function.
- Hmac
Sha384 - HMAC-SHA-384 message authentication code (48-byte tag).
- KeyPair
- A generic key pair bundling a secret key and its corresponding public key.
- Parallel
Hash128 - ParallelHash128 configured with a block size and customization string.
- Parallel
Hash256 - ParallelHash256 configured with a block size and customization string.
- Pbkdf2
Stretch Params - Parameters for the PBKDF2-HMAC-SHA-256 stretching backend.
- RsaPkcs1v15
Sha256 Signer - RSA PKCS#1 v1.5 signing key parameterised with SHA-256.
- RsaPkcs1v15
Sha256 Verifier - RSA PKCS#1 v1.5 verifying key parameterised with SHA-256.
- RsaPkcs1v15
Sha384 Signer - RSA PKCS#1 v1.5 signing key parameterised with SHA-384.
- RsaPkcs1v15
Sha384 Verifier - RSA PKCS#1 v1.5 verifying key parameterised with SHA-384.
- RsaPkcs1v15
Sha512 Signer - RSA PKCS#1 v1.5 signing key parameterised with SHA-512.
- RsaPkcs1v15
Sha512 Verifier - RSA PKCS#1 v1.5 verifying key parameterised with SHA-512.
- RsaPss
Sha256 Signer - RSA-PSS signing key parameterised with SHA-256.
- RsaPss
Sha256 Verifier - RSA-PSS verifying key parameterised with SHA-256.
- RsaPss
Sha384 Signer - RSA-PSS signing key parameterised with SHA-384.
- RsaPss
Sha384 Verifier - RSA-PSS verifying key parameterised with SHA-384.
- RsaPss
Sha512 Signer - RSA-PSS signing key parameterised with SHA-512.
- RsaPss
Sha512 Verifier - RSA-PSS verifying key parameterised with SHA-512.
- Schnorr
Bip340 - BIP-340 Schnorr signatures over secp256k1.
- Scrypt
Stretch Params - Parameters for the scrypt stretching backend.
- Secret
Key - A fixed-size secret key that is automatically zeroed when dropped.
- Secret
Vec - A heap-allocated, variable-length secret that is automatically zeroed when dropped.
- Stretcher
- The built-in
KeyStretcherimplementation, parameterized byStretchParams. - XCha
Cha20 Poly1305 - XChaCha20-Poly1305 authenticated encryption with a 24-byte nonce.
Enums§
- Algorithm
Category - Canonical algorithm category.
- Algorithm
Id - Canonical algorithm identifier covering all OxiCrypto algorithm families.
- Balloon
Variant - Underlying hash selector for
BalloonHasher. - Crypto
Error - Unified error type for all OxiCrypto operations.
- Stretch
Params - Algorithm + parameter selection for a
Stretcher. - TlsCipher
Suite - TLS cipher suite → MAC negotiation.
Traits§
- Aead
- Authenticated Encryption with Associated Data (AEAD).
- Constant
Time Eq - An
Eq-like trait that produces aChoiceinstead of abool. - Hash
- Stateless hash function (SHA-2, SHA-3, BLAKE3, …).
- Kdf
- Key derivation function (HKDF, PBKDF2, …).
- KeyAgreement
- Diffie-Hellman or similar key-agreement primitive.
- KeyStretcher
- An object-safe key-stretching interface.
- Mac
- Message Authentication Code (HMAC, CMAC, KMAC, Poly1305, …).
- Rng
- Cryptographically-secure random number generator.
- Signer
- Asymmetric signing operation.
- Streaming
Hash - Incremental (streaming) hash computation.
- Streaming
Mac - Incremental (streaming) MAC computation.
- Verifier
- Asymmetric signature verification.
- Zeroize
- Trait for securely erasing values from memory.
- Zeroize
OnDrop - Marker trait signifying that this type will
Zeroize::zeroizeitself onDrop.
Functions§
- aes128_
key_ unwrap - Unwrap
wrappedwith a 128-bit Key Encryption Key (KEK) using AES-128-KW. - aes128_
key_ wrap - Wrap
datawith a 128-bit Key Encryption Key (KEK) using AES-128-KW. - aes256_
key_ unwrap - Unwrap
wrappedwith a 256-bit Key Encryption Key (KEK) using AES-256-KW. - aes256_
key_ wrap - Wrap
datawith a 256-bit Key Encryption Key (KEK) using AES-256-KW. - argon2id_
derive - Argon2id key derivation.
- balloon_
sha256 - Balloon password hash over SHA-256, writing 32 bytes into
out. - balloon_
sha512 - Balloon password hash over SHA-512, writing 64 bytes into
out. - blake3
- Compute BLAKE3 of
msg, returning a 32-byte array. - ct_eq
- Constant-time byte-slice equality comparison.
- ct_
is_ zero - Constant-time check whether every byte in
datais zero. - ct_
select - Constant-time conditional select: returns
aifchoiceis0, orbifchoiceis1. Any otherchoicevalue is treated as1. - hkdf_
expand_ label_ sha256 HKDF-Expand-Labelwith SHA-256 (RFC 8446 §7.1).- hkdf_
expand_ label_ sha384 HKDF-Expand-Labelwith SHA-384 (RFC 8446 §7.1).- hkdf_
sha256_ expand - Perform HKDF-Expand with SHA-256 from a pre-extracted PRK.
- hkdf_
sha256_ extract - Perform HKDF-Extract with SHA-256, returning the pseudorandom key (PRK).
- hkdf_
sha384_ expand - Perform HKDF-Expand with SHA-384 from a pre-extracted PRK.
- hkdf_
sha384_ extract - Perform HKDF-Extract with SHA-384, returning the pseudorandom key (PRK).
- hkdf_
sha512_ expand - Perform HKDF-Expand with SHA-512 from a pre-extracted PRK.
- hkdf_
sha512_ extract - Perform HKDF-Extract with SHA-512, returning the pseudorandom key (PRK).
- mac_
name_ for_ suite - TLS cipher suite → MAC negotiation.
- negotiate_
mac - TLS cipher suite → MAC negotiation.
- new_rng
- Create a new OS-seeded CSPRNG.
- open_
box - Open a sealed box produced by
seal_box. - parallel_
hash128 - ParallelHash128 with fixed output length (NIST SP 800-185 §6.1).
- parallel_
hash256 - ParallelHash256 with fixed output length (NIST SP 800-185 §6.2).
- parallel_
hash128_ xof - ParallelHash128 in extendable-output (XOF) mode (NIST SP 800-185 §6.3).
- parallel_
hash256_ xof - ParallelHash256 in extendable-output (XOF) mode (NIST SP 800-185 §6.3).
- pbkdf2_
sha256 - PBKDF2-HMAC-SHA-256 key derivation.
- pbkdf2_
sha512 - PBKDF2-HMAC-SHA-512 key derivation.
- random_
bytes - Allocate and fill a
Vec<u8>withlencryptographically secure random bytes. - random_
nonce - Generate a random nonce of
Nbytes for use with AEAD algorithms. - random_
range - Generate a random integer in
[min, max)using rejection sampling to eliminate modulo bias. - reseed
- Perform a manual reseed of the given
OxiRngfrom OS entropy. - schnorr_
bip340_ sign_ with_ aux - Convenience: produce a heap-allocated
Vec<u8>signature with explicit auxiliary randomness. MirrorsSchnorrBip340::sign_with_auxbut returns aVecfor callers that prefer an owned buffer over a fixed array. - scrypt_
derive - Scrypt key derivation.
- seal_
box - Seal
plaintextusing a freshly-generated random nonce. - seal_
with_ random_ nonce - Encrypt
plaintextwith a freshly-generated random nonce. - sha256
- Compute SHA-256 of
msg, returning a 32-byte array. - sha512
- Compute SHA-512 of
msg, returning a 64-byte array.
Derive Macros§
- Zeroize
- Derive the
Zeroizetrait. - Zeroize
OnDrop - Derive the
ZeroizeOnDroptrait.