Skip to content

Instantly share code, notes, and snippets.

@acoomans
Last active August 29, 2015 14:02
Show Gist options
  • Select an option

  • Save acoomans/d34765b7abcc1fbbf89d to your computer and use it in GitHub Desktop.

Select an option

Save acoomans/d34765b7abcc1fbbf89d to your computer and use it in GitHub Desktop.
How to calculate a MAC without leaking computation-time (side channel) info
// Everything you need to know about cryptography in 1 hour
// http://www.daemonology.net/papers/crypto1hr.pdf
for (x = i = 0; i < MACLEN; i++) {
x |= MAC_computed[i] − MAC_received[i];
}
return (x ? MAC_GOOD : MAC_BAD);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment