Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion scrypt/src/params.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,20 @@ impl Params {

/// log₂ of the Scrypt parameter `N`, the work factor.
///
/// Memory and CPU usage scale linearly with `N`.
/// Memory and CPU usage scale linearly with `N`. If you need `N`, use
/// [`Params::n`] instead.
pub const fn log_n(&self) -> u8 {
self.log_n
}

/// `N` parameter: the work factor.
///
/// This method returns 2 to the power of [`Params::log_n`]. Memory and CPU
/// usage scale linearly with `N`.
pub const fn n(&self) -> u64 {
1 << self.log_n
}

/// `r` parameter: resource usage.
///
/// scrypt iterates 2*r times. Memory and CPU time scale linearly
Expand Down