Skip to content

Commit

Permalink
Use pbkdf2_hmac
Browse files Browse the repository at this point in the history
Signed-off-by: Christian König <[email protected]>
  • Loading branch information
yubiuser committed Apr 2, 2023
1 parent f4ec772 commit 379c127
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions core/src/authentication.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ use std::io::{self, Read};

use aes::Aes192;
use byteorder::{BigEndian, ByteOrder};
use hmac::Hmac;
use pbkdf2::pbkdf2;
use pbkdf2::pbkdf2_hmac;
use protobuf::Enum;
use serde::{Deserialize, Serialize};
use sha1::{Digest, Sha1};
Expand Down Expand Up @@ -96,8 +95,7 @@ impl Credentials {
return Err(AuthenticationError::Key.into());
}

let res = pbkdf2::<Hmac<Sha1>>(&secret, username.as_bytes(), 0x100, &mut key[0..20]);
assert!(res.is_ok(), "Failed to create hash");
pbkdf2_hmac::<Sha1>(&secret, username.as_bytes(), 0x100, &mut key[0..20]);

let hash = &Sha1::digest(&key[..20]);
key[..20].copy_from_slice(hash);
Expand Down

0 comments on commit 379c127

Please sign in to comment.