Skip to content

Commit f0d5956

Browse files
authored
Merge pull request #587 from uuid-rs/feat/fast-sha1
Use the sha1_smol library for SHA1
2 parents 5aa53c8 + 165b7eb commit f0d5956

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

Cargo.toml

+4-4
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ js = ["private_getrandom", "private_getrandom/js"]
6565
rng = ["private_getrandom"]
6666
fast-rng = ["rng", "private_rand"]
6767

68-
sha1 = ["private_sha1"]
68+
sha1 = ["private_sha1_smol"]
6969
md5 = ["private_md-5"]
7070

7171
# Public: Used in trait impls on `Uuid`
@@ -121,11 +121,11 @@ version = "0.10"
121121
# Private
122122
# Don't depend on this optional feature directly: it may change at any time
123123
# Use the `sha1` feature instead
124-
[dependencies.private_sha1]
125-
package = "sha1"
124+
[dependencies.private_sha1_smol]
125+
package = "sha1_smol"
126126
default-features = false
127127
optional = true
128-
version = "0.10"
128+
version = "1"
129129

130130
# Public: Re-exported
131131
# Don't depend on this optional feature directly: it may change at any time

src/sha1.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
#[cfg(feature = "v5")]
22
pub(crate) fn hash(ns: &[u8], src: &[u8]) -> [u8; 16] {
3-
use private_sha1::{Sha1, Digest};
3+
use private_sha1_smol::Sha1;
44

55
let mut hasher = Sha1::new();
66

77
hasher.update(ns);
88
hasher.update(src);
99

1010
let mut bytes = [0; 16];
11-
bytes.copy_from_slice(&hasher.finalize()[..16]);
11+
bytes.copy_from_slice(&hasher.digest().bytes()[..16]);
1212

1313
bytes
1414
}

0 commit comments

Comments
 (0)