pub struct KeyDerivationParams {
pub salt: [u8; 16],
pub iterations: u32,
}Expand description
Parameters for deriving an encryption key from a user-supplied secret.
Architectural intent: Encapsulates the tunable inputs for PBKDF2-based key derivation so that snapshot metadata fully describes how to reproduce the encryption key on restore.
Constraints: salt must be unique per snapshot to avoid key reuse, and
iterations is chosen to be intentionally expensive (hundreds of thousands
of rounds) to raise the cost of offline brute-force attacks while remaining
acceptable for interactive CLI usage.
Side effects: Instances produced via Default consume randomness from
the process RNG and implicitly fix the work factor at the compile-time
constant embedded in this type.
Fields§
§salt: [u8; 16]§iterations: u32Trait Implementations§
Source§impl Clone for KeyDerivationParams
impl Clone for KeyDerivationParams
Source§fn clone(&self) -> KeyDerivationParams
fn clone(&self) -> KeyDerivationParams
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for KeyDerivationParams
impl Debug for KeyDerivationParams
Source§impl Default for KeyDerivationParams
impl Default for KeyDerivationParams
Source§fn default() -> Self
fn default() -> Self
Generates key-derivation parameters for a new snapshot.
Architectural intent: Produces a fresh random salt and a stable iteration count that all writers and readers agree on, so that keys can be recomputed deterministically from the password and stored metadata.
Constraints: The salt is 128 bits and sampled uniformly from the system RNG; the iteration count is fixed to a value calibrated for this application and must be kept in sync with password prompts.
Side effects: Pulls entropy from rand::thread_rng and performs no
I/O; increasing the iteration count will linearly increase CPU cost for
both snapshot creation and decryption.