Skip to main content

Crate oxicrypto_kdf

Crate oxicrypto_kdf 

Source
Expand description

Pure Rust KDF implementations for the OxiCrypto stack.

FunctionModuleBackend
HKDF-SHA-256 / SHA-512(inline)hkdf
HKDF-Expand-Label (TLS 1.3 / QUIC)hkdf_labelhkdf
PBKDF2-SHA-256 / SHA-512pbkdf2_kdfpbkdf2
Argon2idargon2_kdfargon2
scryptscrypt_kdfscrypt
Balloon (SHA-256 / SHA-512)balloonsha2

Re-exports§

pub use argon2_kdf::argon2d_derive;
pub use argon2_kdf::argon2i_derive;
pub use argon2_kdf::argon2id_derive;
pub use argon2_kdf::argon2id_to_phc_string;
pub use argon2_kdf::argon2id_verify_phc;
pub use argon2_kdf::Argon2Params;
pub use argon2_kdf::Argon2idHasher;
pub use balloon::balloon_sha256;
pub use balloon::balloon_sha256_secret;
pub use balloon::balloon_sha512;
pub use balloon::balloon_sha512_secret;
pub use balloon::BalloonHasher;
pub use balloon::BalloonParams;
pub use balloon::BalloonVariant;
pub use balloon::BALLOON_DELTA;
pub use hkdf_label::hkdf_expand_label_sha256;
pub use hkdf_label::hkdf_expand_label_sha384;
pub use kbkdf::kbkdf_counter_hmac_sha256;
pub use kbkdf::kbkdf_counter_hmac_sha256_secret;
pub use kbkdf::kbkdf_counter_hmac_sha384;
pub use kbkdf::kbkdf_counter_hmac_sha512;
pub use pbkdf2_kdf::pbkdf2_sha256;
pub use pbkdf2_kdf::pbkdf2_sha512;
pub use pbkdf2_kdf::Pbkdf2Params;
pub use pbkdf2_kdf::Pbkdf2Sha256Hasher;
pub use pbkdf2_kdf::Pbkdf2Sha512Hasher;
pub use scrypt_kdf::scrypt_derive;
pub use scrypt_kdf::ScryptHasher;
pub use scrypt_kdf::ScryptParams;
pub use stretcher::Argon2idStretchParams;
pub use stretcher::BalloonStretchParams;
pub use stretcher::KeyStretcher;
pub use stretcher::Pbkdf2StretchParams;
pub use stretcher::ScryptStretchParams;
pub use stretcher::StretchParams;
pub use stretcher::Stretcher;

Modules§

argon2_kdf
Argon2id password hashing / key derivation for the OxiCrypto stack.
balloon
Balloon memory-hard password hashing for the OxiCrypto stack.
hkdf_label
TLS 1.3 HKDF-Expand-Label (RFC 8446 §7.1).
kbkdf
KBKDF counter mode per NIST SP 800-108 Rev. 1, Section 4.1.
pbkdf2_kdf
PBKDF2 password-based key derivation for the OxiCrypto stack.
scrypt_kdf
Scrypt password-based key derivation for the OxiCrypto stack.
stretcher
A unifying KeyStretcher abstraction over the crate’s memory-hard and iteration-hard password-based key-derivation functions.

Structs§

HkdfSha256
HKDF-SHA-256 key derivation function.
HkdfSha384
HKDF-SHA-384 key derivation function.
HkdfSha512
HKDF-SHA-512 key derivation function.

Constants§

PBKDF2_SHA256_MIN_ITERATIONS
OWASP 2023 Password Storage Cheat Sheet minimum iteration count for PBKDF2-HMAC-SHA-256.
PBKDF2_SHA512_MIN_ITERATIONS
OWASP 2023 Password Storage Cheat Sheet minimum iteration count for PBKDF2-HMAC-SHA-512.

Functions§

generate_salt_16
Generate a random 16-byte salt using the system CSPRNG.
generate_salt_32
Generate a random 32-byte salt using the system CSPRNG.
hkdf_sha256_derive_to_vec
Derive len bytes from ikm, salt, and info using HKDF-SHA-256, returning the output as an owned Vec<u8>.
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_derive_to_vec
Derive len bytes from ikm, salt, and info using HKDF-SHA-384, returning the output as an owned Vec<u8>.
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_derive_to_vec
Derive len bytes from ikm, salt, and info using HKDF-SHA-512, returning the output as an owned Vec<u8>.
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).
verify_password
Verify a password by re-hashing and comparing in constant time.