File tree Expand file tree Collapse file tree 1 file changed +1
-14
lines changed Expand file tree Collapse file tree 1 file changed +1
-14
lines changed Original file line number Diff line number Diff line change 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 {
3229impl 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.
You can’t perform that action at this time.
0 commit comments