diff --git a/src/aes_hash.rs b/src/aes_hash.rs index d3b673f..175a962 100644 --- a/src/aes_hash.rs +++ b/src/aes_hash.rs @@ -81,15 +81,15 @@ impl AHasher { #[inline(always)] fn hash_in(&mut self, new_value: u128) { - self.enc = aesenc(self.enc, new_value); + self.enc = aesdec(self.enc, new_value); self.sum = shuffle_and_add(self.sum, new_value); } #[inline(always)] fn hash_in_2(&mut self, v1: u128, v2: u128) { - self.enc = aesenc(self.enc, v1); + self.enc = aesdec(self.enc, v1); self.sum = shuffle_and_add(self.sum, v1); - self.enc = aesenc(self.enc, v2); + self.enc = aesdec(self.enc, v2); self.sum = shuffle_and_add(self.sum, v2); } @@ -174,10 +174,10 @@ impl Hasher for AHasher { sum[1] = shuffle_and_add(sum[1], tail[3]); while data.len() > 64 { let (blocks, rest) = data.read_u128x4(); - current[0] = aesenc(current[0], blocks[0]); - current[1] = aesenc(current[1], blocks[1]); - current[2] = aesenc(current[2], blocks[2]); - current[3] = aesenc(current[3], blocks[3]); + current[0] = aesdec(current[0], blocks[0]); + current[1] = aesdec(current[1], blocks[1]); + current[2] = aesdec(current[2], blocks[2]); + current[3] = aesdec(current[3], blocks[3]); sum[0] = shuffle_and_add(sum[0], blocks[0]); sum[1] = shuffle_and_add(sum[1], blocks[1]); sum[0] = shuffle_and_add(sum[0], blocks[2]);