diff options
author | Andreas Grois <andi@grois.info> | 2023-01-20 21:03:08 +0100 |
---|---|---|
committer | Andreas Grois <andi@grois.info> | 2023-01-20 21:13:39 +0100 |
commit | 212f20c72d703908f6e81b5d569b33d9f5a6ee85 (patch) | |
tree | 35e135e437375640cefd62398ad9fabc300891ce /src/passwordmaker/mod.rs | |
parent | a55761caefadafbd88a743dd1f6d5811f6791b86 (diff) |
Simplify HMAC function.v0.2.0
It's quite a bit faster, and easier to understand.
Diffstat (limited to 'src/passwordmaker/mod.rs')
-rw-r--r-- | src/passwordmaker/mod.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/passwordmaker/mod.rs b/src/passwordmaker/mod.rs index db01a78..e266b2b 100644 --- a/src/passwordmaker/mod.rs +++ b/src/passwordmaker/mod.rs @@ -112,7 +112,7 @@ impl<'y, H : super::HasherList> super::PasswordMaker<'y, H>{ let data = leetified_data.as_deref().unwrap_or(data); let key = yeet_upper_bytes(&key); let data = yeet_upper_bytes(data); - let hash = hmac::hmac::<H::MD5,_,_>(key, data); + let hash = hmac::hmac::<H::MD5,_>(&key.collect::<Vec<_>>(), data); let grapheme_indices = hash.convert_to_base(characters.len()); GetGraphemesIterator { graphemes : characters, inner: GetGraphemesIteratorInner::V06(grapheme_indices)} } @@ -244,7 +244,7 @@ fn modern_hmac_to_grapheme_indices<T>(key : &str, data: &str, divisor : usize) - where T:Hasher, <T as Hasher>::Output: BaseConversion + AsRef<[u8]> { - hmac::hmac::<T,_,_>(key.bytes(), data.bytes()).convert_to_base(divisor) + hmac::hmac::<T,_>(key.as_bytes(), data.bytes()).convert_to_base(divisor) } fn modern_message_to_grapheme_indices<T>(data: &str, divisor : usize) -> <<T as Hasher>::Output as BaseConversion>::Output |