Last active
February 17, 2021 08:34
-
-
Save evost/82cb19d806aac8eb7dd256ad5efaf8a5 to your computer and use it in GitHub Desktop.
This file contains 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
unsigned int funcT(unsigned int a) { | |
unsigned int res = 0; | |
res ^= p[0][a & 0x0000000f]; | |
res ^= (p[1][((a & 0x000000f0) >> 4)] << 4); | |
res ^= (p[2][((a & 0x00000f00) >> 8)] << 8); | |
res ^= (p[3][((a & 0x0000f000) >> 12)] << 12); | |
res ^= (p[4][((a & 0x000f0000) >> 16)] << 16); | |
res ^= (p[5][((a & 0x00f00000) >> 20)] << 20); | |
res ^= (p[6][((a & 0x0f000000) >> 24)] << 24); | |
res ^= (p[7][((a & 0xf0000000) >> 28)] << 28); | |
return res; | |
} | |
unsigned int funcG(unsigned int a, unsigned int k) { | |
unsigned int c = a + k; | |
unsigned int tmp = funcT(c, print); | |
unsigned int r = (tmp << 11) | (tmp >> 21); | |
return r; | |
} | |
void Round(unsigned int* a1, unsigned int* a0, unsigned int k) { | |
unsigned int a; | |
unsigned int tmp; | |
a = *a0; | |
tmp = funcG(*a0, k); | |
*a0 = *a1 ^ tmp; | |
*a1 = a; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment