Skip to content

Commit

Permalink
fix iter
Browse files Browse the repository at this point in the history
  • Loading branch information
conradludgate committed Mar 20, 2024
1 parent e5575c8 commit 87d6145
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions postgres-protocol/src/authentication/sasl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ fn normalize(pass: &[u8]) -> Vec<u8> {
}
}

pub(crate) async fn hi(str: &[u8], salt: &[u8], i: u32) -> [u8; 32] {
pub(crate) async fn hi(str: &[u8], salt: &[u8], iterations: u32) -> [u8; 32] {
let mut hmac =
Hmac::<Sha256>::new_from_slice(str).expect("HMAC is able to accept all key sizes");
hmac.update(salt);
Expand All @@ -42,7 +42,7 @@ pub(crate) async fn hi(str: &[u8], salt: &[u8], i: u32) -> [u8; 32] {

let mut hi = prev;

for _ in 1..i {
for i in 1..iterations {
let mut hmac = Hmac::<Sha256>::new_from_slice(str).expect("already checked above");
hmac.update(&prev);
prev = hmac.finalize().into_bytes();
Expand Down

0 comments on commit 87d6145

Please sign in to comment.