Skip to main content

aescrypt_rs/kdf/
mod.rs

1//! Key Derivation Functions used by AES Crypt v0–v3.
2//!
3//! Two KDFs are wired in, gated by file format version:
4//!
5//! - [`ackdf`] — AES Crypt Key Derivation Function: 8192 SHA-256 iterations
6//!   over a UTF-16-LE password and 16-byte salt, used by v0/v1/v2 files
7//!   (read-only).
8//! - [`pbkdf2`] — PBKDF2-HMAC-SHA512 with caller-controlled iteration count
9//!   (default [`crate::constants::DEFAULT_PBKDF2_ITERATIONS`]), used by v3
10//!   files (read and write).
11//!
12//! Most callers should use the high-level [`encrypt`](crate::encrypt()) and
13//! [`decrypt`](crate::decrypt()) functions, which select the right KDF
14//! automatically. These primitives are exposed for custom decryption flows,
15//! such as reading legacy files outside the full high-level API.
16//!
17//! # Security
18//!
19//! ACKDF is fixed at 8192 SHA-256 iterations by spec; it is weak by modern
20//! standards and exists solely for compatibility with v0–v2 files. PBKDF2
21//! iterations should never go below
22//! [`DEFAULT_PBKDF2_ITERATIONS`](crate::constants::DEFAULT_PBKDF2_ITERATIONS).
23
24pub mod ackdf;
25pub mod pbkdf2;
26