Skip to content

Commit

Permalink
Make methods of scrypt::Params to const fn (#508)
Browse files Browse the repository at this point in the history
  • Loading branch information
sorairolake authored Jul 8, 2024
1 parent e54197e commit b06febc
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions scrypt/src/params.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ impl Params {
/// - `log_n = 17` (`n = 131072`)
/// - `r = 8`
/// - `p = 1`
pub fn recommended() -> Params {
pub const fn recommended() -> Params {
Params {
log_n: Self::RECOMMENDED_LOG_N,
r: Self::RECOMMENDED_R,
Expand All @@ -103,20 +103,20 @@ impl Params {
/// log₂ of the Scrypt parameter `N`, the work factor.
///
/// Memory and CPU usage scale linearly with `N`.
pub fn log_n(&self) -> u8 {
pub const 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 {
pub const fn r(&self) -> u32 {
self.r
}

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

0 comments on commit b06febc

Please sign in to comment.