Skip to content

Instantly share code, notes, and snippets.

@extremecoders-re
Created April 22, 2016 19:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save extremecoders-re/499d461753b50998f81c9011895f10fe to your computer and use it in GitHub Desktop.
Save extremecoders-re/499d461753b50998f81c9011895f10fe to your computer and use it in GitHub Desktop.
static uint16_t rotl(uint16_t value, uint16_t shift)
{
return (value << shift) | (value >> (32 - shift));
}
static void s20_quarterround(uint16_t *y0, uint16_t *y1, uint16_t *y2, uint16_t *y3)
{
*y1 = *y1 ^ rotl(*y0 + *y3, 7);
*y2 = *y2 ^ rotl(*y1 + *y0, 9);
*y3 = *y3 ^ rotl(*y2 + *y1, 13);
*y0 = *y0 ^ rotl(*y3 + *y2, 18);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment