diff --git a/scrypt/src/params.rs b/scrypt/src/params.rs index d957a017..449f758b 100644 --- a/scrypt/src/params.rs +++ b/scrypt/src/params.rs @@ -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