Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make methods of scrypt::Params to const fn #508

Merged
merged 1 commit into from
Jul 8, 2024
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
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