-
Notifications
You must be signed in to change notification settings - Fork 191
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #587 from uuid-rs/feat/fast-sha1
Use the sha1_smol library for SHA1
- Loading branch information
Showing
2 changed files
with
6 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,14 @@ | ||
#[cfg(feature = "v5")] | ||
pub(crate) fn hash(ns: &[u8], src: &[u8]) -> [u8; 16] { | ||
use private_sha1::{Sha1, Digest}; | ||
use private_sha1_smol::Sha1; | ||
|
||
let mut hasher = Sha1::new(); | ||
|
||
hasher.update(ns); | ||
hasher.update(src); | ||
|
||
let mut bytes = [0; 16]; | ||
bytes.copy_from_slice(&hasher.finalize()[..16]); | ||
bytes.copy_from_slice(&hasher.digest().bytes()[..16]); | ||
|
||
bytes | ||
} |