Expand description
Cryptographic primitive implementations and adapters.
This crate provides implementations of various cryptographic primitives
with explicit validation and zeroization boundaries. Constant-time behavior
and no_std support are primitive- and feature-specific; the crate does not
make blanket guarantees for either property.
§Security Features
Relevant defensive patterns include:
- Secure memory handling with automatic zeroization
- Constant-time comparison operations
- Memory barrier utilities
- Secure operation patterns
Re-exports§
pub use error::validate;pub use error::Error;pub use error::Result;pub use block::Aes128;pub use block::Aes192;pub use block::Aes256;pub use block::Cbc;pub use block::Ctr;pub use hash::Blake2b;pub use hash::Blake2s;pub use hash::Keccak256;pub use hash::Sha1;pub use hash::Sha224;pub use hash::Sha256;pub use hash::Sha384;pub use hash::Sha3_224;pub use hash::Sha3_256;pub use hash::Sha3_384;pub use hash::Sha3_512;pub use hash::Sha512;pub use hash::Shake128;pub use hash::Shake256;pub use aead::AeadCipher;pub use aead::ChaCha20Poly1305;pub use aead::ChaCha20Poly1305Cipher;pub use aead::Gcm;pub use aead::XChaCha20Poly1305;pub use mac::Hmac;pub use mac::Poly1305;pub use stream::chacha::chacha20::ChaCha20;pub use kdf::Argon2;pub use kdf::Hkdf;pub use kdf::KeyDerivationFunction;pub use kdf::PasswordHashFunction;pub use kdf::Pbkdf2;pub use ec::p256;pub use ec::p384;pub use ec::p521;pub use ec::P256Point;pub use ec::P256Scalar;pub use ec::P384Point;pub use ec::P384Scalar;pub use ec::P521Point;pub use ec::P521Scalar;pub use types::ByteSerializable;pub use types::ConstantTimeEq;pub use types::Digest;pub use types::FixedSize;pub use types::Nonce;pub use types::RandomGeneration;pub use types::Salt;pub use types::Tag;pub use types::algorithms::Aes128 as Aes128Algorithm;pub use types::algorithms::Aes256 as Aes256Algorithm;pub use types::algorithms::ChaCha20 as ChaCha20Algorithm;pub use types::algorithms::ChaCha20Poly1305 as ChaCha20Poly1305Algorithm;pub use types::algorithms::Ed25519 as Ed25519Algorithm;pub use types::algorithms::P521 as P521Algorithm;pub use types::algorithms::X25519 as X25519Algorithm;pub use types::digest::Blake2bCompatible;pub use types::digest::Keccak256Compatible;pub use types::digest::Sha256Compatible;pub use types::digest::Sha512Compatible;pub use types::key::AsymmetricPublicKey;pub use types::key::AsymmetricSecretKey;pub use types::key::SymmetricKey;pub use types::nonce::AesCtrCompatible;pub use types::nonce::AesGcmCompatible;pub use types::nonce::ChaCha20Compatible;pub use types::nonce::XChaCha20Compatible;pub use types::salt::Argon2Compatible;pub use types::salt::HkdfCompatible;pub use types::salt::Pbkdf2Compatible;pub use types::tag::ChaCha20Poly1305Compatible;pub use types::tag::GcmCompatible;pub use types::tag::HmacCompatible;pub use types::tag::Poly1305Compatible;pub use xof::Blake3Xof;pub use xof::ExtendableOutputFunction;pub use xof::ShakeXof128;pub use xof::ShakeXof256;pub use poly::ntt::montgomery_reduce;pub use poly::ntt::CooleyTukeyNtt;pub use poly::ntt::InverseNttOperator;pub use poly::ntt::NttOperator;pub use poly::params::MlDsaParams;pub use poly::params::Modulus;pub use poly::params::NttModulus;pub use poly::polynomial::Polynomial;pub use poly::prelude;pub use poly::sampling::CbdSampler;pub use poly::sampling::DefaultSamplers;pub use poly::sampling::UniformSampler;pub use poly::serialize::CoefficientPacker;pub use poly::serialize::CoefficientUnpacker;pub use poly::serialize::DefaultCoefficientSerde;
Modules§
- aead
- Authenticated Encryption with Associated Data (AEAD) with operation pattern
- barrier
- Memory barrier utilities
- block
- Block cipher implementations with advanced type-level guarantees
- ec
- Elliptic Curve Primitives
- error
- Error handling for cryptographic primitives
- hash
- Cryptographic hash function implementations with enhanced type safety
- kdf
- Key Derivation Functions with operation pattern and type-level guarantees
- mac
- Message Authentication Code (MAC) implementations with type-safe interfaces
- poly
- Generic Polynomial Engine
- stream
- Stream cipher implementations
- types
- Type-safe wrappers for cryptographic types
- xof
- Extendable Output Functions (XOF)
Structs§
- Ephemeral
Secret - Ephemeral secret that invokes explicit clearing on drop.
- Secret
Buffer - A fixed-size byte array that explicitly clears its owned storage on drop.
- Secret
Bytes - A fixed-size byte array that explicitly clears its owned storage on drop.
- Secret
Vec - Exact-size owned bytes whose initialized storage is explicitly cleared on drop.
- Zeroize
Guard - Guard type that invokes a value’s
Zeroizeimplementation when dropped.
Traits§
- Secure
Compare - Trait for types that can be securely compared
- Secure
Zeroing Type - Trait for types that explicitly clear owned storage and preserve that behavior when cloned.