1
0
mirror of https://github.com/hashcat/hashcat.git synced 2025-01-22 21:51:07 +00:00

aes256 test 01 + OpenCL/m13400.cl aes const optimization

This commit is contained in:
Gabriele Gristina 2016-11-29 00:49:03 +01:00
parent d9ff76052b
commit d815667880

View File

@ -704,34 +704,34 @@ static void aes256_ExpandKey (u32 *ks, const u32 *ukey)
int i; int i;
int j; int j;
for (i = 0, j = 0; i < 8; j += 8) for (int i = 0, j = 0; i < 7; i += 1, j += 8)
{ {
u32 temp = ks[j + 7]; const u32 temp1 = ks[j + 7];
ks[j + 8] = ks[j + 0] ks[j + 8] = ks[j + 0]
^ (te2[(temp >> 16) & 0xff] & 0xff000000) ^ (te2[(temp1 >> 16) & 0xff] & 0xff000000)
^ (te3[(temp >> 8) & 0xff] & 0x00ff0000) ^ (te3[(temp1 >> 8) & 0xff] & 0x00ff0000)
^ (te0[(temp >> 0) & 0xff] & 0x0000ff00) ^ (te0[(temp1 >> 0) & 0xff] & 0x0000ff00)
^ (te1[(temp >> 24) & 0xff] & 0x000000ff) ^ (te1[(temp1 >> 24) & 0xff] & 0x000000ff)
^ rcon[i]; ^ rcon[i];
ks[j + 9] = ks[j + 1] ^ ks[j + 8]; ks[j + 9] = ks[j + 1] ^ ks[j + 8];
ks[j + 10] = ks[j + 2] ^ ks[j + 9]; ks[j + 10] = ks[j + 2] ^ ks[j + 9];
ks[j + 11] = ks[j + 3] ^ ks[j + 10]; ks[j + 11] = ks[j + 3] ^ ks[j + 10];
if (++i == 7) break; if (i == 6) continue;
temp = ks[j + 11]; const u32 temp2 = ks[j + 11];
ks[j + 12] = ks[j + 4] ks[j + 12] = ks[j + 4]
^ (te2[(temp >> 24) & 0xff] & 0xff000000) ^ (te2[(temp2 >> 24) & 0xff] & 0xff000000)
^ (te3[(temp >> 16) & 0xff] & 0x00ff0000) ^ (te3[(temp2 >> 16) & 0xff] & 0x00ff0000)
^ (te0[(temp >> 8) & 0xff] & 0x0000ff00) ^ (te0[(temp2 >> 8) & 0xff] & 0x0000ff00)
^ (te1[(temp >> 0) & 0xff] & 0x000000ff); ^ (te1[(temp2 >> 0) & 0xff] & 0x000000ff);
ks[j + 13] = ks[j + 5] ^ ks[j + 12]; ks[j + 13] = ks[j + 5] ^ ks[j + 12];
ks[j + 14] = ks[j + 6] ^ ks[j + 13]; ks[j + 14] = ks[j + 6] ^ ks[j + 13];
ks[j + 15] = ks[j + 7] ^ ks[j + 14]; ks[j + 15] = ks[j + 7] ^ ks[j + 14];
} }
} }