Created
January 20, 2011 21:58
-
-
Save xoebus/788771 to your computer and use it in GitHub Desktop.
Cryptographic Array Comparisons
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// VERY BAD | |
for (i = 0; i < MAC_LEN; i++) | |
{ | |
if (MAC_computed[i] != MAC_received[i]) | |
{ | |
return MAC_IS_BAD; | |
} | |
} | |
return MAC_IS_GOOD; | |
// GOOD | |
for (x = i = 0; i < MAC_LEN; i++) | |
{ | |
x |= MAC_computed[i] − MAC_received[i]; | |
} | |
return (x ? MAC_IS_BAD : MAC_IS_GOOD); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment