Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix two problems with the short_finish
Browse files Browse the repository at this point in the history
* 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 <[email protected]>
tkaitchuck committed Mar 29, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent 98ee5b2 commit 6e5bfa6
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/aes_hash.rs
Original file line number Diff line number Diff line change
@@ -97,9 +97,9 @@ impl AHasher {
#[inline]
#[cfg(feature = "specialize")]
fn short_finish(&self) -> u64 {
let combined = aesenc(self.sum, self.enc);
let result: [u64; 2] = aesdec(combined, combined).convert();
result[0]
let combined = aesdec(self.enc, self.sum);
let result: [u64; 2] = aesdec(combined, self.key).convert();
result[0] ^ result[1]
}

#[inline]

0 comments on commit 6e5bfa6

Please sign in to comment.