Skip to content

Commit 6e5bfa6

Browse files
committed
Fix two problems with the short_finish
* If on ARM where the xor happens first the same value cannot be used for both parameters. * XOR the two halfs of the output to avoid the possibility that two bit diffs can cancel Signed-off-by: Tom Kaitchuck <Tom.Kaitchuck@gmail.com>
1 parent 98ee5b2 commit 6e5bfa6

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/aes_hash.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,9 @@ impl AHasher {
9797
#[inline]
9898
#[cfg(feature = "specialize")]
9999
fn short_finish(&self) -> u64 {
100-
let combined = aesenc(self.sum, self.enc);
101-
let result: [u64; 2] = aesdec(combined, combined).convert();
102-
result[0]
100+
let combined = aesdec(self.enc, self.sum);
101+
let result: [u64; 2] = aesdec(combined, self.key).convert();
102+
result[0] ^ result[1]
103103
}
104104

105105
#[inline]

0 commit comments

Comments
 (0)