Skip to content

Commit

Permalink
Merge pull request #15 from tmpfs/android-ceil
Browse files Browse the repository at this point in the history
Explicit ceil() when computing log_n.
  • Loading branch information
roynalnaruto committed Jul 5, 2023
2 parents 6ed8840 + b96267d commit 85ea8cd
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,9 @@ where
salt,
} => {
let mut key = vec![0u8; dklen as usize];
let log_n = (n as f32).log2() as u8;
// TODO: use int_log https://github.com/rust-lang/rust/issues/70887
// TODO: when it is stable
let log_n = (n as f32).log2().ceil() as u8;
let scrypt_params = ScryptParams::new(log_n, r, p)?;
scrypt(password.as_ref(), &salt, &scrypt_params, key.as_mut_slice())?;
key
Expand Down

0 comments on commit 85ea8cd

Please sign in to comment.