@@ -82,14 +82,6 @@ impl AHasher {
8282 }
8383 }
8484
85- #[ inline( always) ]
86- fn add_in_length ( & mut self , length : u64 ) {
87- //This will be scrambled by the next AES round.
88- let mut enc: [ u64 ; 2 ] = self . enc . convert ( ) ;
89- enc[ 0 ] = enc[ 0 ] . wrapping_add ( length) ;
90- self . enc = enc. convert ( ) ;
91- }
92-
9385 #[ inline( always) ]
9486 fn hash_in ( & mut self , new_value : u128 ) {
9587 self . enc = aesenc ( self . enc , new_value) ;
@@ -159,7 +151,8 @@ impl Hasher for AHasher {
159151 fn write ( & mut self , input : & [ u8 ] ) {
160152 let mut data = input;
161153 let length = data. len ( ) ;
162- self . add_in_length ( length as u64 ) ;
154+ add_in_length ( & mut self . enc , length as u64 ) ;
155+
163156 //A 'binary search' on sizes reduces the number of comparisons.
164157 if data. len ( ) <= 8 {
165158 let value = read_small ( data) ;
@@ -337,7 +330,8 @@ impl Hasher for AHasherStr {
337330 self . 0 . enc = aesdec ( self . 0 . sum , self . 0 . enc ) ;
338331 self . 0 . enc = aesenc ( aesenc ( self . 0 . enc , self . 0 . key ) , self . 0 . enc ) ;
339332 } else {
340- self . 0 . add_in_length ( bytes. len ( ) as u64 ) ;
333+ add_in_length ( & mut self . 0 . enc , bytes. len ( ) as u64 ) ;
334+
341335 let value = read_small ( bytes) . convert ( ) ;
342336 self . 0 . sum = shuffle_and_add ( self . 0 . sum , value) ;
343337 self . 0 . enc = aesdec ( self . 0 . sum , self . 0 . enc ) ;
0 commit comments