Skip to content

Commit 65aab56

Browse files
committed
change!: drop gix_hash::{hasher::Digest, Hasher::digest()}
Complete the transition to `ObjectId` returns.
1 parent 4e935ce commit 65aab56

File tree

1 file changed

+1
-14
lines changed

1 file changed

+1
-14
lines changed

gix-hash/src/hasher/mod.rs

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
use sha1_checked::CollisionResult;
2-
3-
/// A hash-digest produced by a [`Hasher`] hash implementation.
4-
pub type Digest = [u8; 20];
1+
use sha1_checked::{CollisionResult, Digest};
52

63
/// The error returned by [`Hasher::try_finalize()`].
74
#[derive(Debug, thiserror::Error)]
@@ -32,7 +29,6 @@ impl Default for Hasher {
3229
impl Hasher {
3330
/// Digest the given `bytes`.
3431
pub fn update(&mut self, bytes: &[u8]) {
35-
use sha1_checked::Digest;
3632
self.0.update(bytes);
3733
}
3834

@@ -67,15 +63,6 @@ impl Hasher {
6763
pub fn finalize(self) -> crate::ObjectId {
6864
self.try_finalize().expect("Detected SHA-1 collision attack")
6965
}
70-
71-
/// Finalize the hash and produce a digest.
72-
#[inline]
73-
pub fn digest(self) -> Digest {
74-
self.finalize()
75-
.as_slice()
76-
.try_into()
77-
.expect("SHA-1 object ID to be 20 bytes long")
78-
}
7966
}
8067

8168
/// Produce a hasher suitable for the given kind of hash.

0 commit comments

Comments
 (0)