File tree Expand file tree Collapse file tree 1 file changed +4
-8
lines changed
src/uucore/src/lib/features Expand file tree Collapse file tree 1 file changed +4
-8
lines changed Original file line number Diff line number Diff line change @@ -199,11 +199,8 @@ impl Digest for CRC32B {
199199 }
200200
201201 fn hash_finalize ( & mut self , out : & mut [ u8 ] ) {
202- let result = self . digest . finalize ( ) ;
203- // crc_fast returns a 64-bit value, but CRC32B should be 32-bit
204- // Take the lower 32 bits and convert to big-endian bytes
205- let crc32_value = ( result & 0xffffffff ) as u32 ;
206- out. copy_from_slice ( & crc32_value. to_be_bytes ( ) ) ;
202+ let result = self . digest . finalize ( ) as u32 ;
203+ out. copy_from_slice ( & result. to_be_bytes ( ) ) ;
207204 }
208205
209206 fn reset ( & mut self ) {
@@ -215,9 +212,8 @@ impl Digest for CRC32B {
215212 }
216213
217214 fn result_str ( & mut self ) -> String {
218- let mut out = [ 0 ; 4 ] ;
219- self . hash_finalize ( & mut out) ;
220- format ! ( "{}" , u32 :: from_be_bytes( out) )
215+ let result = ( self . digest . finalize ( ) as u32 ) . to_be_bytes ( ) ;
216+ format ! ( "{}" , u32 :: from_be_bytes( result) )
221217 }
222218}
223219
You can’t perform that action at this time.
0 commit comments