Skip to content

Commit

Permalink
scrypt: add Params accessor methods
Browse files Browse the repository at this point in the history
  • Loading branch information
tarcieri committed Feb 6, 2021
1 parent ec75ff8 commit 1bb21b1
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions scrypt/src/params.rs
Expand Up @@ -90,6 +90,26 @@ impl Params {
len: RECOMMENDED_LEN,
}
}

/// log2 of the Scrypt parameter `N`, the work factor.
///
/// Memory and CPU usage scale linearly with `N`.
pub fn log_n(&self) -> u8 {
self.log_n
}

/// `r` parameter: resource usage.
///
/// scrypt iterates 2*r times. Memory and CPU time scale linearly
/// with this parameter.
pub fn r(&self) -> u32 {
self.r
}

/// `p` parameter: parallelization.
pub fn p(&self) -> u32 {
self.p
}
}

impl Default for Params {
Expand Down

0 comments on commit 1bb21b1

Please sign in to comment.