@@ -81,23 +81,23 @@ impl AHasher {
8181
8282 #[ inline( always) ]
8383 fn hash_in ( & mut self , new_value : u128 ) {
84- self . enc = aesdec ( self . enc , new_value) ;
84+ self . enc = aesenc ( self . enc , new_value) ;
8585 self . sum = shuffle_and_add ( self . sum , new_value) ;
8686 }
8787
8888 #[ inline( always) ]
8989 fn hash_in_2 ( & mut self , v1 : u128 , v2 : u128 ) {
90- self . enc = aesdec ( self . enc , v1) ;
90+ self . enc = aesenc ( self . enc , v1) ;
9191 self . sum = shuffle_and_add ( self . sum , v1) ;
92- self . enc = aesdec ( self . enc , v2) ;
92+ self . enc = aesenc ( self . enc , v2) ;
9393 self . sum = shuffle_and_add ( self . sum , v2) ;
9494 }
9595
9696 #[ inline]
9797 #[ cfg( feature = "specialize" ) ]
9898 fn short_finish ( & self ) -> u64 {
99- let combined = aesenc ( self . sum , self . enc ) ;
100- let result: [ u64 ; 2 ] = aesdec ( combined, combined) . convert ( ) ;
99+ let combined = aesdec ( self . sum , self . enc ) ;
100+ let result: [ u64 ; 2 ] = aesenc ( combined, combined) . convert ( ) ;
101101 result[ 0 ]
102102 }
103103}
@@ -174,10 +174,10 @@ impl Hasher for AHasher {
174174 sum[ 1 ] = shuffle_and_add ( sum[ 1 ] , tail[ 3 ] ) ;
175175 while data. len ( ) > 64 {
176176 let ( blocks, rest) = data. read_u128x4 ( ) ;
177- current[ 0 ] = aesdec ( current[ 0 ] , blocks[ 0 ] ) ;
178- current[ 1 ] = aesdec ( current[ 1 ] , blocks[ 1 ] ) ;
179- current[ 2 ] = aesdec ( current[ 2 ] , blocks[ 2 ] ) ;
180- current[ 3 ] = aesdec ( current[ 3 ] , blocks[ 3 ] ) ;
177+ current[ 0 ] = aesenc ( current[ 0 ] , blocks[ 0 ] ) ;
178+ current[ 1 ] = aesenc ( current[ 1 ] , blocks[ 1 ] ) ;
179+ current[ 2 ] = aesenc ( current[ 2 ] , blocks[ 2 ] ) ;
180+ current[ 3 ] = aesenc ( current[ 3 ] , blocks[ 3 ] ) ;
181181 sum[ 0 ] = shuffle_and_add ( sum[ 0 ] , blocks[ 0 ] ) ;
182182 sum[ 1 ] = shuffle_and_add ( sum[ 1 ] , blocks[ 1 ] ) ;
183183 sum[ 0 ] = shuffle_and_add ( sum[ 0 ] , blocks[ 2 ] ) ;
@@ -208,9 +208,9 @@ impl Hasher for AHasher {
208208 }
209209 #[ inline]
210210 fn finish ( & self ) -> u64 {
211- let combined = aesenc ( self . sum , self . enc ) ;
212- let result: [ u64 ; 2 ] = aesdec ( aesdec ( combined, self . key ) , combined) . convert ( ) ;
213- result[ 0 ]
211+ let combined = aesdec ( self . sum , self . enc ) ;
212+ let result: [ u64 ; 2 ] = aesenc ( aesenc ( combined, self . key ) , combined) . convert ( ) ;
213+ result[ 1 ]
214214 }
215215}
216216
@@ -329,15 +329,15 @@ impl Hasher for AHasherStr {
329329 fn write ( & mut self , bytes : & [ u8 ] ) {
330330 if bytes. len ( ) > 8 {
331331 self . 0 . write ( bytes) ;
332- self . 0 . enc = aesenc ( self . 0 . sum , self . 0 . enc ) ;
333- self . 0 . enc = aesdec ( aesdec ( self . 0 . enc , self . 0 . key ) , self . 0 . enc ) ;
332+ self . 0 . enc = aesdec ( self . 0 . sum , self . 0 . enc ) ;
333+ self . 0 . enc = aesenc ( aesenc ( self . 0 . enc , self . 0 . key ) , self . 0 . enc ) ;
334334 } else {
335335 add_in_length ( & mut self . 0 . enc , bytes. len ( ) as u64 ) ;
336336
337337 let value = read_small ( bytes) . convert ( ) ;
338338 self . 0 . sum = shuffle_and_add ( self . 0 . sum , value) ;
339- self . 0 . enc = aesenc ( self . 0 . sum , self . 0 . enc ) ;
340- self . 0 . enc = aesdec ( aesdec ( self . 0 . enc , self . 0 . key ) , self . 0 . enc ) ;
339+ self . 0 . enc = aesdec ( self . 0 . sum , self . 0 . enc ) ;
340+ self . 0 . enc = aesenc ( aesenc ( self . 0 . enc , self . 0 . key ) , self . 0 . enc ) ;
341341 }
342342 }
343343
0 commit comments