Add password module for hashing on the client side.
Hashing a password on the client side is useful so that you can set a user's password without ever sending it in plain text to the server. This avoids leaking passwords in the log or elsewhere.
This commit is contained in:
@@ -32,7 +32,7 @@ fn normalize(pass: &[u8]) -> Vec<u8> {
|
||||
}
|
||||
}
|
||||
|
||||
fn hi(str: &[u8], salt: &[u8], i: u32) -> [u8; 32] {
|
||||
pub(crate) fn hi(str: &[u8], salt: &[u8], i: u32) -> [u8; 32] {
|
||||
let mut hmac = Hmac::<Sha256>::new_varkey(str).expect("HMAC is able to accept all key sizes");
|
||||
hmac.update(salt);
|
||||
hmac.update(&[0, 0, 0, 1]);
|
||||
|
||||
Reference in New Issue
Block a user