1
0
mirror of https://github.com/hashcat/hashcat.git synced 2025-01-11 00:01:16 +00:00

Remove no longer needed overwrite_at_* functions

This commit is contained in:
jsteube 2017-08-17 15:53:09 +02:00
parent bf299fe043
commit e984a829ea

View File

@ -31494,842 +31494,6 @@ static void switch_buffer_by_offset_1x64_be (u32x w[64], const u32 offset)
#endif
}
static void overwrite_at_le (u32x sw[16], const u32x w0, const u32 salt_len)
{
#if defined cl_amd_media_ops
switch (salt_len)
{
case 0: sw[0] = w0;
break;
case 1: sw[0] = amd_bytealign (w0, sw[0] << 24, 3);
sw[1] = amd_bytealign (sw[1] >> 8, w0, 3);
break;
case 2: sw[0] = amd_bytealign (w0, sw[0] << 16, 2);
sw[1] = amd_bytealign (sw[1] >> 16, w0, 2);
break;
case 3: sw[0] = amd_bytealign (w0, sw[0] << 8, 1);
sw[1] = amd_bytealign (sw[1] >> 24, w0, 1);
break;
case 4: sw[1] = w0;
break;
case 5: sw[1] = amd_bytealign (w0, sw[1] << 24, 3);
sw[2] = amd_bytealign (sw[2] >> 8, w0, 3);
break;
case 6: sw[1] = amd_bytealign (w0, sw[1] << 16, 2);
sw[2] = amd_bytealign (sw[2] >> 16, w0, 2);
break;
case 7: sw[1] = amd_bytealign (w0, sw[1] << 8, 1);
sw[2] = amd_bytealign (sw[2] >> 24, w0, 1);
break;
case 8: sw[2] = w0;
break;
case 9: sw[2] = amd_bytealign (w0, sw[2] << 24, 3);
sw[3] = amd_bytealign (sw[3] >> 8, w0, 3);
break;
case 10: sw[2] = amd_bytealign (w0, sw[2] << 16, 2);
sw[3] = amd_bytealign (sw[3] >> 16, w0, 2);
break;
case 11: sw[2] = amd_bytealign (w0, sw[2] << 8, 1);
sw[3] = amd_bytealign (sw[3] >> 24, w0, 1);
break;
case 12: sw[3] = w0;
break;
case 13: sw[3] = amd_bytealign (w0, sw[3] << 24, 3);
sw[4] = amd_bytealign (sw[4] >> 8, w0, 3);
break;
case 14: sw[3] = amd_bytealign (w0, sw[3] << 16, 2);
sw[4] = amd_bytealign (sw[4] >> 16, w0, 2);
break;
case 15: sw[3] = amd_bytealign (w0, sw[3] << 8, 1);
sw[4] = amd_bytealign (sw[4] >> 24, w0, 1);
break;
case 16: sw[4] = w0;
break;
case 17: sw[4] = amd_bytealign (w0, sw[4] << 24, 3);
sw[5] = amd_bytealign (sw[5] >> 8, w0, 3);
break;
case 18: sw[4] = amd_bytealign (w0, sw[4] << 16, 2);
sw[5] = amd_bytealign (sw[5] >> 16, w0, 2);
break;
case 19: sw[4] = amd_bytealign (w0, sw[4] << 8, 1);
sw[5] = amd_bytealign (sw[5] >> 24, w0, 1);
break;
case 20: sw[5] = w0;
break;
case 21: sw[5] = amd_bytealign (w0, sw[5] << 24, 3);
sw[6] = amd_bytealign (sw[6] >> 8, w0, 3);
break;
case 22: sw[5] = amd_bytealign (w0, sw[5] << 16, 2);
sw[6] = amd_bytealign (sw[6] >> 16, w0, 2);
break;
case 23: sw[5] = amd_bytealign (w0, sw[5] << 8, 1);
sw[6] = amd_bytealign (sw[6] >> 24, w0, 1);
break;
case 24: sw[6] = w0;
break;
case 25: sw[6] = amd_bytealign (w0, sw[6] << 24, 3);
sw[7] = amd_bytealign (sw[7] >> 8, w0, 3);
break;
case 26: sw[6] = amd_bytealign (w0, sw[6] << 16, 2);
sw[7] = amd_bytealign (sw[7] >> 16, w0, 2);
break;
case 27: sw[6] = amd_bytealign (w0, sw[6] << 8, 1);
sw[7] = amd_bytealign (sw[7] >> 24, w0, 1);
break;
case 28: sw[7] = w0;
break;
case 29: sw[7] = amd_bytealign (w0, sw[7] << 24, 3);
sw[8] = amd_bytealign (sw[8] >> 8, w0, 3);
break;
case 30: sw[7] = amd_bytealign (w0, sw[7] << 16, 2);
sw[8] = amd_bytealign (sw[8] >> 16, w0, 2);
break;
case 31: sw[7] = amd_bytealign (w0, sw[7] << 8, 1);
sw[8] = amd_bytealign (sw[8] >> 24, w0, 1);
break;
}
#else
switch (salt_len)
{
case 0: sw[0] = w0;
break;
case 1: sw[0] = (sw[0] & 0x000000ff) | (w0 << 8);
sw[1] = (sw[1] & 0xffffff00) | (w0 >> 24);
break;
case 2: sw[0] = (sw[0] & 0x0000ffff) | (w0 << 16);
sw[1] = (sw[1] & 0xffff0000) | (w0 >> 16);
break;
case 3: sw[0] = (sw[0] & 0x00ffffff) | (w0 << 24);
sw[1] = (sw[1] & 0xff000000) | (w0 >> 8);
break;
case 4: sw[1] = w0;
break;
case 5: sw[1] = (sw[1] & 0x000000ff) | (w0 << 8);
sw[2] = (sw[2] & 0xffffff00) | (w0 >> 24);
break;
case 6: sw[1] = (sw[1] & 0x0000ffff) | (w0 << 16);
sw[2] = (sw[2] & 0xffff0000) | (w0 >> 16);
break;
case 7: sw[1] = (sw[1] & 0x00ffffff) | (w0 << 24);
sw[2] = (sw[2] & 0xff000000) | (w0 >> 8);
break;
case 8: sw[2] = w0;
break;
case 9: sw[2] = (sw[2] & 0x000000ff) | (w0 << 8);
sw[3] = (sw[3] & 0xffffff00) | (w0 >> 24);
break;
case 10: sw[2] = (sw[2] & 0x0000ffff) | (w0 << 16);
sw[3] = (sw[3] & 0xffff0000) | (w0 >> 16);
break;
case 11: sw[2] = (sw[2] & 0x00ffffff) | (w0 << 24);
sw[3] = (sw[3] & 0xff000000) | (w0 >> 8);
break;
case 12: sw[3] = w0;
break;
case 13: sw[3] = (sw[3] & 0x000000ff) | (w0 << 8);
sw[4] = (sw[4] & 0xffffff00) | (w0 >> 24);
break;
case 14: sw[3] = (sw[3] & 0x0000ffff) | (w0 << 16);
sw[4] = (sw[4] & 0xffff0000) | (w0 >> 16);
break;
case 15: sw[3] = (sw[3] & 0x00ffffff) | (w0 << 24);
sw[4] = (sw[4] & 0xff000000) | (w0 >> 8);
break;
case 16: sw[4] = w0;
break;
case 17: sw[4] = (sw[4] & 0x000000ff) | (w0 << 8);
sw[5] = (sw[5] & 0xffffff00) | (w0 >> 24);
break;
case 18: sw[4] = (sw[4] & 0x0000ffff) | (w0 << 16);
sw[5] = (sw[5] & 0xffff0000) | (w0 >> 16);
break;
case 19: sw[4] = (sw[4] & 0x00ffffff) | (w0 << 24);
sw[5] = (sw[5] & 0xff000000) | (w0 >> 8);
break;
case 20: sw[5] = w0;
break;
case 21: sw[5] = (sw[5] & 0x000000ff) | (w0 << 8);
sw[6] = (sw[6] & 0xffffff00) | (w0 >> 24);
break;
case 22: sw[5] = (sw[5] & 0x0000ffff) | (w0 << 16);
sw[6] = (sw[6] & 0xffff0000) | (w0 >> 16);
break;
case 23: sw[5] = (sw[5] & 0x00ffffff) | (w0 << 24);
sw[6] = (sw[6] & 0xff000000) | (w0 >> 8);
break;
case 24: sw[6] = w0;
break;
case 25: sw[6] = (sw[6] & 0x000000ff) | (w0 << 8);
sw[7] = (sw[7] & 0xffffff00) | (w0 >> 24);
break;
case 26: sw[6] = (sw[6] & 0x0000ffff) | (w0 << 16);
sw[7] = (sw[7] & 0xffff0000) | (w0 >> 16);
break;
case 27: sw[6] = (sw[6] & 0x00ffffff) | (w0 << 24);
sw[7] = (sw[7] & 0xff000000) | (w0 >> 8);
break;
case 28: sw[7] = w0;
break;
case 29: sw[7] = (sw[7] & 0x000000ff) | (w0 << 8);
sw[8] = (sw[8] & 0xffffff00) | (w0 >> 24);
break;
case 30: sw[7] = (sw[7] & 0x0000ffff) | (w0 << 16);
sw[8] = (sw[8] & 0xffff0000) | (w0 >> 16);
break;
case 31: sw[7] = (sw[7] & 0x00ffffff) | (w0 << 24);
sw[8] = (sw[8] & 0xff000000) | (w0 >> 8);
break;
}
#endif
}
static void overwrite_at_be (u32x sw[16], const u32x w0, const u32 salt_len)
{
// would be nice to have optimization based on amd_bytealign as with _le counterpart
switch (salt_len)
{
case 0: sw[0] = w0;
break;
case 1: sw[0] = (sw[0] & 0xff000000) | (w0 >> 8);
sw[1] = (sw[1] & 0x00ffffff) | (w0 << 24);
break;
case 2: sw[0] = (sw[0] & 0xffff0000) | (w0 >> 16);
sw[1] = (sw[1] & 0x0000ffff) | (w0 << 16);
break;
case 3: sw[0] = (sw[0] & 0xffffff00) | (w0 >> 24);
sw[1] = (sw[1] & 0x000000ff) | (w0 << 8);
break;
case 4: sw[1] = w0;
break;
case 5: sw[1] = (sw[1] & 0xff000000) | (w0 >> 8);
sw[2] = (sw[2] & 0x00ffffff) | (w0 << 24);
break;
case 6: sw[1] = (sw[1] & 0xffff0000) | (w0 >> 16);
sw[2] = (sw[2] & 0x0000ffff) | (w0 << 16);
break;
case 7: sw[1] = (sw[1] & 0xffffff00) | (w0 >> 24);
sw[2] = (sw[2] & 0x000000ff) | (w0 << 8);
break;
case 8: sw[2] = w0;
break;
case 9: sw[2] = (sw[2] & 0xff000000) | (w0 >> 8);
sw[3] = (sw[3] & 0x00ffffff) | (w0 << 24);
break;
case 10: sw[2] = (sw[2] & 0xffff0000) | (w0 >> 16);
sw[3] = (sw[3] & 0x0000ffff) | (w0 << 16);
break;
case 11: sw[2] = (sw[2] & 0xffffff00) | (w0 >> 24);
sw[3] = (sw[3] & 0x000000ff) | (w0 << 8);
break;
case 12: sw[3] = w0;
break;
case 13: sw[3] = (sw[3] & 0xff000000) | (w0 >> 8);
sw[4] = (sw[4] & 0x00ffffff) | (w0 << 24);
break;
case 14: sw[3] = (sw[3] & 0xffff0000) | (w0 >> 16);
sw[4] = (sw[4] & 0x0000ffff) | (w0 << 16);
break;
case 15: sw[3] = (sw[3] & 0xffffff00) | (w0 >> 24);
sw[4] = (sw[4] & 0x000000ff) | (w0 << 8);
break;
case 16: sw[4] = w0;
break;
case 17: sw[4] = (sw[4] & 0xff000000) | (w0 >> 8);
sw[5] = (sw[5] & 0x00ffffff) | (w0 << 24);
break;
case 18: sw[4] = (sw[4] & 0xffff0000) | (w0 >> 16);
sw[5] = (sw[5] & 0x0000ffff) | (w0 << 16);
break;
case 19: sw[4] = (sw[4] & 0xffffff00) | (w0 >> 24);
sw[5] = (sw[5] & 0x000000ff) | (w0 << 8);
break;
case 20: sw[5] = w0;
break;
case 21: sw[5] = (sw[5] & 0xff000000) | (w0 >> 8);
sw[6] = (sw[6] & 0x00ffffff) | (w0 << 24);
break;
case 22: sw[5] = (sw[5] & 0xffff0000) | (w0 >> 16);
sw[6] = (sw[6] & 0x0000ffff) | (w0 << 16);
break;
case 23: sw[5] = (sw[5] & 0xffffff00) | (w0 >> 24);
sw[6] = (sw[6] & 0x000000ff) | (w0 << 8);
break;
case 24: sw[6] = w0;
break;
case 25: sw[6] = (sw[6] & 0xff000000) | (w0 >> 8);
sw[7] = (sw[7] & 0x00ffffff) | (w0 << 24);
break;
case 26: sw[6] = (sw[6] & 0xffff0000) | (w0 >> 16);
sw[7] = (sw[7] & 0x0000ffff) | (w0 << 16);
break;
case 27: sw[6] = (sw[6] & 0xffffff00) | (w0 >> 24);
sw[7] = (sw[7] & 0x000000ff) | (w0 << 8);
break;
case 28: sw[7] = w0;
break;
case 29: sw[7] = (sw[7] & 0xff000000) | (w0 >> 8);
sw[8] = (sw[8] & 0x00ffffff) | (w0 << 24);
break;
case 30: sw[7] = (sw[7] & 0xffff0000) | (w0 >> 16);
sw[8] = (sw[8] & 0x0000ffff) | (w0 << 16);
break;
case 31: sw[7] = (sw[7] & 0xffffff00) | (w0 >> 24);
sw[8] = (sw[8] & 0x000000ff) | (w0 << 8);
break;
}
}
static void overwrite_at_le_4x4 (u32x w0[4], u32x w1[4], u32x w2[4], u32x w3[4], const u32x wx, const u32 salt_len)
{
#if defined cl_amd_media_ops
switch (salt_len)
{
case 0: w0[0] = wx;
break;
case 1: w0[0] = amd_bytealign (wx, w0[0] << 24, 3);
w0[1] = amd_bytealign (w0[1] >> 8, wx, 3);
break;
case 2: w0[0] = amd_bytealign (wx, w0[0] << 16, 2);
w0[1] = amd_bytealign (w0[1] >> 16, wx, 2);
break;
case 3: w0[0] = amd_bytealign (wx, w0[0] << 8, 1);
w0[1] = amd_bytealign (w0[1] >> 24, wx, 1);
break;
case 4: w0[1] = wx;
break;
case 5: w0[1] = amd_bytealign (wx, w0[1] << 24, 3);
w0[2] = amd_bytealign (w0[2] >> 8, wx, 3);
break;
case 6: w0[1] = amd_bytealign (wx, w0[1] << 16, 2);
w0[2] = amd_bytealign (w0[2] >> 16, wx, 2);
break;
case 7: w0[1] = amd_bytealign (wx, w0[1] << 8, 1);
w0[2] = amd_bytealign (w0[2] >> 24, wx, 1);
break;
case 8: w0[2] = wx;
break;
case 9: w0[2] = amd_bytealign (wx, w0[2] << 24, 3);
w0[3] = amd_bytealign (w0[3] >> 8, wx, 3);
break;
case 10: w0[2] = amd_bytealign (wx, w0[2] << 16, 2);
w0[3] = amd_bytealign (w0[3] >> 16, wx, 2);
break;
case 11: w0[2] = amd_bytealign (wx, w0[2] << 8, 1);
w0[3] = amd_bytealign (w0[3] >> 24, wx, 1);
break;
case 12: w0[3] = wx;
break;
case 13: w0[3] = amd_bytealign (wx, w0[3] << 24, 3);
w1[0] = amd_bytealign (w1[0] >> 8, wx, 3);
break;
case 14: w0[3] = amd_bytealign (wx, w0[3] << 16, 2);
w1[0] = amd_bytealign (w1[0] >> 16, wx, 2);
break;
case 15: w0[3] = amd_bytealign (wx, w0[3] << 8, 1);
w1[0] = amd_bytealign (w1[0] >> 24, wx, 1);
break;
case 16: w1[0] = wx;
break;
case 17: w1[0] = amd_bytealign (wx, w1[0] << 24, 3);
w1[1] = amd_bytealign (w1[1] >> 8, wx, 3);
break;
case 18: w1[0] = amd_bytealign (wx, w1[0] << 16, 2);
w1[1] = amd_bytealign (w1[1] >> 16, wx, 2);
break;
case 19: w1[0] = amd_bytealign (wx, w1[0] << 8, 1);
w1[1] = amd_bytealign (w1[1] >> 24, wx, 1);
break;
case 20: w1[1] = wx;
break;
case 21: w1[1] = amd_bytealign (wx, w1[1] << 24, 3);
w1[2] = amd_bytealign (w1[2] >> 8, wx, 3);
break;
case 22: w1[1] = amd_bytealign (wx, w1[1] << 16, 2);
w1[2] = amd_bytealign (w1[2] >> 16, wx, 2);
break;
case 23: w1[1] = amd_bytealign (wx, w1[1] << 8, 1);
w1[2] = amd_bytealign (w1[2] >> 24, wx, 1);
break;
case 24: w1[2] = wx;
break;
case 25: w1[2] = amd_bytealign (wx, w1[2] << 24, 3);
w1[3] = amd_bytealign (w1[3] >> 8, wx, 3);
break;
case 26: w1[2] = amd_bytealign (wx, w1[2] << 16, 2);
w1[3] = amd_bytealign (w1[3] >> 16, wx, 2);
break;
case 27: w1[2] = amd_bytealign (wx, w1[2] << 8, 1);
w1[3] = amd_bytealign (w1[3] >> 24, wx, 1);
break;
case 28: w1[3] = wx;
break;
case 29: w1[3] = amd_bytealign (wx, w1[3] << 24, 3);
w2[0] = amd_bytealign (w2[0] >> 8, wx, 3);
break;
case 30: w1[3] = amd_bytealign (wx, w1[3] << 16, 2);
w2[0] = amd_bytealign (w2[0] >> 16, wx, 2);
break;
case 31: w1[3] = amd_bytealign (wx, w1[3] << 8, 1);
w2[0] = amd_bytealign (w2[0] >> 24, wx, 1);
break;
case 32: w2[0] = wx;
break;
case 33: w2[0] = amd_bytealign (wx, w2[0] << 24, 3);
w2[1] = amd_bytealign (w2[1] >> 8, wx, 3);
break;
case 34: w2[0] = amd_bytealign (wx, w2[0] << 16, 2);
w2[1] = amd_bytealign (w2[1] >> 16, wx, 2);
break;
case 35: w2[0] = amd_bytealign (wx, w2[0] << 8, 1);
w2[1] = amd_bytealign (w2[1] >> 24, wx, 1);
break;
case 36: w2[1] = wx;
break;
case 37: w2[1] = amd_bytealign (wx, w2[1] << 24, 3);
w2[2] = amd_bytealign (w2[2] >> 8, wx, 3);
break;
case 38: w2[1] = amd_bytealign (wx, w2[1] << 16, 2);
w2[2] = amd_bytealign (w2[2] >> 16, wx, 2);
break;
case 39: w2[1] = amd_bytealign (wx, w2[1] << 8, 1);
w2[2] = amd_bytealign (w2[2] >> 24, wx, 1);
break;
case 40: w2[2] = wx;
break;
case 41: w2[2] = amd_bytealign (wx, w2[2] << 24, 3);
w2[3] = amd_bytealign (w2[3] >> 8, wx, 3);
break;
case 42: w2[2] = amd_bytealign (wx, w2[2] << 16, 2);
w2[3] = amd_bytealign (w2[3] >> 16, wx, 2);
break;
case 43: w2[2] = amd_bytealign (wx, w2[2] << 8, 1);
w2[3] = amd_bytealign (w2[3] >> 24, wx, 1);
break;
case 44: w2[3] = wx;
break;
case 45: w2[3] = amd_bytealign (wx, w2[3] << 24, 3);
w3[0] = amd_bytealign (w3[0] >> 8, wx, 3);
break;
case 46: w2[3] = amd_bytealign (wx, w2[3] << 16, 2);
w3[0] = amd_bytealign (w3[0] >> 16, wx, 2);
break;
case 47: w2[3] = amd_bytealign (wx, w2[3] << 8, 1);
w3[0] = amd_bytealign (w3[0] >> 24, wx, 1);
break;
case 48: w3[0] = wx;
break;
case 49: w3[0] = amd_bytealign (wx, w3[0] << 24, 3);
w3[1] = amd_bytealign (w3[1] >> 8, wx, 3);
break;
case 50: w3[0] = amd_bytealign (wx, w3[0] << 16, 2);
w3[1] = amd_bytealign (w3[1] >> 16, wx, 2);
break;
case 51: w3[0] = amd_bytealign (wx, w3[0] << 8, 1);
w3[1] = amd_bytealign (w3[1] >> 24, wx, 1);
break;
case 52: w3[1] = wx;
break;
case 53: w3[1] = amd_bytealign (wx, w3[1] << 24, 3);
w3[2] = amd_bytealign (w3[2] >> 8, wx, 3);
break;
case 54: w3[1] = amd_bytealign (wx, w3[1] << 16, 2);
w3[2] = amd_bytealign (w3[2] >> 16, wx, 2);
break;
case 55: w3[1] = amd_bytealign (wx, w3[1] << 8, 1);
w3[2] = amd_bytealign (w3[2] >> 24, wx, 1);
break;
case 56: w3[2] = wx;
break;
case 57: w3[2] = amd_bytealign (wx, w3[2] << 24, 3);
w3[3] = amd_bytealign (w3[3] >> 8, wx, 3);
break;
case 58: w3[2] = amd_bytealign (wx, w3[2] << 16, 2);
w3[3] = amd_bytealign (w3[3] >> 16, wx, 2);
break;
case 59: w3[2] = amd_bytealign (wx, w3[2] << 8, 1);
w3[3] = amd_bytealign (w3[3] >> 24, wx, 1);
break;
case 60: w3[3] = wx;
break;
case 61: w3[3] = amd_bytealign (wx, w3[3] << 24, 3);
//w4[0] = amd_bytealign (w4[0] >> 8, wx, 3);
break;
case 62: w3[3] = amd_bytealign (wx, w3[3] << 16, 2);
//w4[0] = amd_bytealign (w4[0] >> 16, wx, 2);
break;
case 63: w3[3] = amd_bytealign (wx, w3[3] << 8, 1);
//w4[0] = amd_bytealign (w4[0] >> 24, wx, 1);
break;
}
#else
switch (salt_len)
{
case 0: w0[0] = wx;
break;
case 1: w0[0] = (w0[0] & 0x000000ff) | (wx << 8);
w0[1] = (w0[1] & 0xffffff00) | (wx >> 24);
break;
case 2: w0[0] = (w0[0] & 0x0000ffff) | (wx << 16);
w0[1] = (w0[1] & 0xffff0000) | (wx >> 16);
break;
case 3: w0[0] = (w0[0] & 0x00ffffff) | (wx << 24);
w0[1] = (w0[1] & 0xff000000) | (wx >> 8);
break;
case 4: w0[1] = wx;
break;
case 5: w0[1] = (w0[1] & 0x000000ff) | (wx << 8);
w0[2] = (w0[2] & 0xffffff00) | (wx >> 24);
break;
case 6: w0[1] = (w0[1] & 0x0000ffff) | (wx << 16);
w0[2] = (w0[2] & 0xffff0000) | (wx >> 16);
break;
case 7: w0[1] = (w0[1] & 0x00ffffff) | (wx << 24);
w0[2] = (w0[2] & 0xff000000) | (wx >> 8);
break;
case 8: w0[2] = wx;
break;
case 9: w0[2] = (w0[2] & 0x000000ff) | (wx << 8);
w0[3] = (w0[3] & 0xffffff00) | (wx >> 24);
break;
case 10: w0[2] = (w0[2] & 0x0000ffff) | (wx << 16);
w0[3] = (w0[3] & 0xffff0000) | (wx >> 16);
break;
case 11: w0[2] = (w0[2] & 0x00ffffff) | (wx << 24);
w0[3] = (w0[3] & 0xff000000) | (wx >> 8);
break;
case 12: w0[3] = wx;
break;
case 13: w0[3] = (w0[3] & 0x000000ff) | (wx << 8);
w1[0] = (w1[0] & 0xffffff00) | (wx >> 24);
break;
case 14: w0[3] = (w0[3] & 0x0000ffff) | (wx << 16);
w1[0] = (w1[0] & 0xffff0000) | (wx >> 16);
break;
case 15: w0[3] = (w0[3] & 0x00ffffff) | (wx << 24);
w1[0] = (w1[0] & 0xff000000) | (wx >> 8);
break;
case 16: w1[0] = wx;
break;
case 17: w1[0] = (w1[0] & 0x000000ff) | (wx << 8);
w1[1] = (w1[1] & 0xffffff00) | (wx >> 24);
break;
case 18: w1[0] = (w1[0] & 0x0000ffff) | (wx << 16);
w1[1] = (w1[1] & 0xffff0000) | (wx >> 16);
break;
case 19: w1[0] = (w1[0] & 0x00ffffff) | (wx << 24);
w1[1] = (w1[1] & 0xff000000) | (wx >> 8);
break;
case 20: w1[1] = wx;
break;
case 21: w1[1] = (w1[1] & 0x000000ff) | (wx << 8);
w1[2] = (w1[2] & 0xffffff00) | (wx >> 24);
break;
case 22: w1[1] = (w1[1] & 0x0000ffff) | (wx << 16);
w1[2] = (w1[2] & 0xffff0000) | (wx >> 16);
break;
case 23: w1[1] = (w1[1] & 0x00ffffff) | (wx << 24);
w1[2] = (w1[2] & 0xff000000) | (wx >> 8);
break;
case 24: w1[2] = wx;
break;
case 25: w1[2] = (w1[2] & 0x000000ff) | (wx << 8);
w1[3] = (w1[3] & 0xffffff00) | (wx >> 24);
break;
case 26: w1[2] = (w1[2] & 0x0000ffff) | (wx << 16);
w1[3] = (w1[3] & 0xffff0000) | (wx >> 16);
break;
case 27: w1[2] = (w1[2] & 0x00ffffff) | (wx << 24);
w1[3] = (w1[3] & 0xff000000) | (wx >> 8);
break;
case 28: w1[3] = wx;
break;
case 29: w1[3] = (w1[3] & 0x000000ff) | (wx << 8);
w2[0] = (w2[0] & 0xffffff00) | (wx >> 24);
break;
case 30: w1[3] = (w1[3] & 0x0000ffff) | (wx << 16);
w2[0] = (w2[0] & 0xffff0000) | (wx >> 16);
break;
case 31: w1[3] = (w1[3] & 0x00ffffff) | (wx << 24);
w2[0] = (w2[0] & 0xff000000) | (wx >> 8);
break;
case 32: w2[0] = wx;
break;
case 33: w2[0] = (w2[0] & 0x000000ff) | (wx << 8);
w2[1] = (w2[1] & 0xffffff00) | (wx >> 24);
break;
case 34: w2[0] = (w2[0] & 0x0000ffff) | (wx << 16);
w2[1] = (w2[1] & 0xffff0000) | (wx >> 16);
break;
case 35: w2[0] = (w2[0] & 0x00ffffff) | (wx << 24);
w2[1] = (w2[1] & 0xff000000) | (wx >> 8);
break;
case 36: w2[1] = wx;
break;
case 37: w2[1] = (w2[1] & 0x000000ff) | (wx << 8);
w2[2] = (w2[2] & 0xffffff00) | (wx >> 24);
break;
case 38: w2[1] = (w2[1] & 0x0000ffff) | (wx << 16);
w2[2] = (w2[2] & 0xffff0000) | (wx >> 16);
break;
case 39: w2[1] = (w2[1] & 0x00ffffff) | (wx << 24);
w2[2] = (w2[2] & 0xff000000) | (wx >> 8);
break;
case 40: w2[2] = wx;
break;
case 41: w2[2] = (w2[2] & 0x000000ff) | (wx << 8);
w2[3] = (w2[3] & 0xffffff00) | (wx >> 24);
break;
case 42: w2[2] = (w2[2] & 0x0000ffff) | (wx << 16);
w2[3] = (w2[3] & 0xffff0000) | (wx >> 16);
break;
case 43: w2[2] = (w2[2] & 0x00ffffff) | (wx << 24);
w2[3] = (w2[3] & 0xff000000) | (wx >> 8);
break;
case 44: w2[3] = wx;
break;
case 45: w2[3] = (w2[3] & 0x000000ff) | (wx << 8);
w3[0] = (w3[0] & 0xffffff00) | (wx >> 24);
break;
case 46: w2[3] = (w2[3] & 0x0000ffff) | (wx << 16);
w3[0] = (w3[0] & 0xffff0000) | (wx >> 16);
break;
case 47: w2[3] = (w2[3] & 0x00ffffff) | (wx << 24);
w3[0] = (w3[0] & 0xff000000) | (wx >> 8);
break;
case 48: w3[0] = wx;
break;
case 49: w3[0] = (w3[0] & 0x000000ff) | (wx << 8);
w3[1] = (w3[1] & 0xffffff00) | (wx >> 24);
break;
case 50: w3[0] = (w3[0] & 0x0000ffff) | (wx << 16);
w3[1] = (w3[1] & 0xffff0000) | (wx >> 16);
break;
case 51: w3[0] = (w3[0] & 0x00ffffff) | (wx << 24);
w3[1] = (w3[1] & 0xff000000) | (wx >> 8);
break;
case 52: w3[1] = wx;
break;
case 53: w3[1] = (w3[1] & 0x000000ff) | (wx << 8);
w3[2] = (w3[2] & 0xffffff00) | (wx >> 24);
break;
case 54: w3[1] = (w3[1] & 0x0000ffff) | (wx << 16);
w3[2] = (w3[2] & 0xffff0000) | (wx >> 16);
break;
case 55: w3[1] = (w3[1] & 0x00ffffff) | (wx << 24);
w3[2] = (w3[2] & 0xff000000) | (wx >> 8);
break;
case 56: w3[2] = wx;
break;
case 57: w3[2] = (w3[2] & 0x000000ff) | (wx << 8);
w3[3] = (w3[3] & 0xffffff00) | (wx >> 24);
break;
case 58: w3[2] = (w3[2] & 0x0000ffff) | (wx << 16);
w3[3] = (w3[3] & 0xffff0000) | (wx >> 16);
break;
case 59: w3[2] = (w3[2] & 0x00ffffff) | (wx << 24);
w3[3] = (w3[3] & 0xff000000) | (wx >> 8);
break;
case 60: w3[3] = wx;
break;
case 61: w3[3] = (w3[3] & 0x000000ff) | (wx << 8);
//w4[0] = (w4[0] & 0xffffff00) | (wx >> 24);
break;
case 62: w3[3] = (w3[3] & 0x0000ffff) | (wx << 16);
//w4[0] = (w4[0] & 0xffff0000) | (wx >> 16);
break;
case 63: w3[3] = (w3[3] & 0x00ffffff) | (wx << 24);
//w4[0] = (w4[0] & 0xff000000) | (wx >> 8);
break;
}
#endif
}
static void overwrite_at_be_4x4 (u32x w0[4], u32x w1[4], u32x w2[4], u32x w3[4], const u32x wx, const u32 salt_len)
{
// would be nice to have optimization based on amd_bytealign as with _le counterpart
switch (salt_len)
{
case 0: w0[0] = wx;
break;
case 1: w0[0] = (w0[0] & 0xff000000) | (wx >> 8);
w0[1] = (w0[1] & 0x00ffffff) | (wx << 24);
break;
case 2: w0[0] = (w0[0] & 0xffff0000) | (wx >> 16);
w0[1] = (w0[1] & 0x0000ffff) | (wx << 16);
break;
case 3: w0[0] = (w0[0] & 0xffffff00) | (wx >> 24);
w0[1] = (w0[1] & 0x000000ff) | (wx << 8);
break;
case 4: w0[1] = wx;
break;
case 5: w0[1] = (w0[1] & 0xff000000) | (wx >> 8);
w0[2] = (w0[2] & 0x00ffffff) | (wx << 24);
break;
case 6: w0[1] = (w0[1] & 0xffff0000) | (wx >> 16);
w0[2] = (w0[2] & 0x0000ffff) | (wx << 16);
break;
case 7: w0[1] = (w0[1] & 0xffffff00) | (wx >> 24);
w0[2] = (w0[2] & 0x000000ff) | (wx << 8);
break;
case 8: w0[2] = wx;
break;
case 9: w0[2] = (w0[2] & 0xff000000) | (wx >> 8);
w0[3] = (w0[3] & 0x00ffffff) | (wx << 24);
break;
case 10: w0[2] = (w0[2] & 0xffff0000) | (wx >> 16);
w0[3] = (w0[3] & 0x0000ffff) | (wx << 16);
break;
case 11: w0[2] = (w0[2] & 0xffffff00) | (wx >> 24);
w0[3] = (w0[3] & 0x000000ff) | (wx << 8);
break;
case 12: w0[3] = wx;
break;
case 13: w0[3] = (w0[3] & 0xff000000) | (wx >> 8);
w1[0] = (w1[0] & 0x00ffffff) | (wx << 24);
break;
case 14: w0[3] = (w0[3] & 0xffff0000) | (wx >> 16);
w1[0] = (w1[0] & 0x0000ffff) | (wx << 16);
break;
case 15: w0[3] = (w0[3] & 0xffffff00) | (wx >> 24);
w1[0] = (w1[0] & 0x000000ff) | (wx << 8);
break;
case 16: w1[0] = wx;
break;
case 17: w1[0] = (w1[0] & 0xff000000) | (wx >> 8);
w1[1] = (w1[1] & 0x00ffffff) | (wx << 24);
break;
case 18: w1[0] = (w1[0] & 0xffff0000) | (wx >> 16);
w1[1] = (w1[1] & 0x0000ffff) | (wx << 16);
break;
case 19: w1[0] = (w1[0] & 0xffffff00) | (wx >> 24);
w1[1] = (w1[1] & 0x000000ff) | (wx << 8);
break;
case 20: w1[1] = wx;
break;
case 21: w1[1] = (w1[1] & 0xff000000) | (wx >> 8);
w1[2] = (w1[2] & 0x00ffffff) | (wx << 24);
break;
case 22: w1[1] = (w1[1] & 0xffff0000) | (wx >> 16);
w1[2] = (w1[2] & 0x0000ffff) | (wx << 16);
break;
case 23: w1[1] = (w1[1] & 0xffffff00) | (wx >> 24);
w1[2] = (w1[2] & 0x000000ff) | (wx << 8);
break;
case 24: w1[2] = wx;
break;
case 25: w1[2] = (w1[2] & 0xff000000) | (wx >> 8);
w1[3] = (w1[3] & 0x00ffffff) | (wx << 24);
break;
case 26: w1[2] = (w1[2] & 0xffff0000) | (wx >> 16);
w1[3] = (w1[3] & 0x0000ffff) | (wx << 16);
break;
case 27: w1[2] = (w1[2] & 0xffffff00) | (wx >> 24);
w1[3] = (w1[3] & 0x000000ff) | (wx << 8);
break;
case 28: w1[3] = wx;
break;
case 29: w1[3] = (w1[3] & 0xff000000) | (wx >> 8);
w2[0] = (w2[0] & 0x00ffffff) | (wx << 24);
break;
case 30: w1[3] = (w1[3] & 0xffff0000) | (wx >> 16);
w2[0] = (w2[0] & 0x0000ffff) | (wx << 16);
break;
case 31: w1[3] = (w1[3] & 0xffffff00) | (wx >> 24);
w2[0] = (w2[0] & 0x000000ff) | (wx << 8);
break;
case 32: w2[0] = wx;
break;
case 33: w2[0] = (w2[0] & 0xff000000) | (wx >> 8);
w2[1] = (w2[1] & 0x00ffffff) | (wx << 24);
break;
case 34: w2[0] = (w2[0] & 0xffff0000) | (wx >> 16);
w2[1] = (w2[1] & 0x0000ffff) | (wx << 16);
break;
case 35: w2[0] = (w2[0] & 0xffffff00) | (wx >> 24);
w2[1] = (w2[1] & 0x000000ff) | (wx << 8);
break;
case 36: w2[1] = wx;
break;
case 37: w2[1] = (w2[1] & 0xff000000) | (wx >> 8);
w2[2] = (w2[2] & 0x00ffffff) | (wx << 24);
break;
case 38: w2[1] = (w2[1] & 0xffff0000) | (wx >> 16);
w2[2] = (w2[2] & 0x0000ffff) | (wx << 16);
break;
case 39: w2[1] = (w2[1] & 0xffffff00) | (wx >> 24);
w2[2] = (w2[2] & 0x000000ff) | (wx << 8);
break;
case 40: w2[2] = wx;
break;
case 41: w2[2] = (w2[2] & 0xff000000) | (wx >> 8);
w2[3] = (w2[3] & 0x00ffffff) | (wx << 24);
break;
case 42: w2[2] = (w2[2] & 0xffff0000) | (wx >> 16);
w2[3] = (w2[3] & 0x0000ffff) | (wx << 16);
break;
case 43: w2[2] = (w2[2] & 0xffffff00) | (wx >> 24);
w2[3] = (w2[3] & 0x000000ff) | (wx << 8);
break;
case 44: w2[3] = wx;
break;
case 45: w2[3] = (w2[3] & 0xff000000) | (wx >> 8);
w3[0] = (w3[0] & 0x00ffffff) | (wx << 24);
break;
case 46: w2[3] = (w2[3] & 0xffff0000) | (wx >> 16);
w3[0] = (w3[0] & 0x0000ffff) | (wx << 16);
break;
case 47: w2[3] = (w2[3] & 0xffffff00) | (wx >> 24);
w3[0] = (w3[0] & 0x000000ff) | (wx << 8);
break;
case 48: w3[0] = wx;
break;
case 49: w3[0] = (w3[0] & 0xff000000) | (wx >> 8);
w3[1] = (w3[1] & 0x00ffffff) | (wx << 24);
break;
case 50: w3[0] = (w3[0] & 0xffff0000) | (wx >> 16);
w3[1] = (w3[1] & 0x0000ffff) | (wx << 16);
break;
case 51: w3[0] = (w3[0] & 0xffffff00) | (wx >> 24);
w3[1] = (w3[1] & 0x000000ff) | (wx << 8);
break;
case 52: w3[1] = wx;
break;
case 53: w3[1] = (w3[1] & 0xff000000) | (wx >> 8);
w3[2] = (w3[2] & 0x00ffffff) | (wx << 24);
break;
case 54: w3[1] = (w3[1] & 0xffff0000) | (wx >> 16);
w3[2] = (w3[2] & 0x0000ffff) | (wx << 16);
break;
case 55: w3[1] = (w3[1] & 0xffffff00) | (wx >> 24);
w3[2] = (w3[2] & 0x000000ff) | (wx << 8);
break;
case 56: w3[2] = wx;
break;
case 57: w3[2] = (w3[2] & 0xff000000) | (wx >> 8);
w3[3] = (w3[3] & 0x00ffffff) | (wx << 24);
break;
case 58: w3[2] = (w3[2] & 0xffff0000) | (wx >> 16);
w3[3] = (w3[3] & 0x0000ffff) | (wx << 16);
break;
case 59: w3[2] = (w3[2] & 0xffffff00) | (wx >> 24);
w3[3] = (w3[3] & 0x000000ff) | (wx << 8);
break;
case 60: w3[3] = wx;
break;
case 61: w3[3] = (w3[3] & 0xff000000) | (wx >> 8);
//w4[0] = (w4[0] & 0x00ffffff) | (wx << 24);
break;
case 62: w3[3] = (w3[3] & 0xffff0000) | (wx >> 16);
//w4[0] = (w4[0] & 0x0000ffff) | (wx << 16);
break;
case 63: w3[3] = (w3[3] & 0xffffff00) | (wx >> 24);
//w4[0] = (w4[0] & 0x000000ff) | (wx << 8);
break;
}
}
/**
* vector functions as scalar (for outer loop usage)
*/