mirror of
https://github.com/hashcat/hashcat
synced 2024-11-28 05:21:38 +01:00
Revert some RC4 based kernels back to scalar processing
This commit is contained in:
parent
b57a143e42
commit
aa55adf652
1082
OpenCL/m09700_a3.cl
1082
OpenCL/m09700_a3.cl
File diff suppressed because it is too large
Load Diff
@ -5,8 +5,6 @@
|
|||||||
|
|
||||||
#define _OLDOFFICE01_
|
#define _OLDOFFICE01_
|
||||||
|
|
||||||
#define NEW_SIMD_CODE
|
|
||||||
|
|
||||||
#include "include/constants.h"
|
#include "include/constants.h"
|
||||||
#include "include/kernel_vendor.h"
|
#include "include/kernel_vendor.h"
|
||||||
|
|
||||||
@ -37,10 +35,10 @@ static void swap (__local RC4_KEY *rc4_key, const u8 i, const u8 j)
|
|||||||
rc4_key->S[j] = tmp;
|
rc4_key->S[j] = tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void rc4_init_16 (__local RC4_KEY *rc4_key, const u32x data[4])
|
static void rc4_init_16 (__local RC4_KEY *rc4_key, const u32 data[4])
|
||||||
{
|
{
|
||||||
u32x v = 0x03020100;
|
u32 v = 0x03020100;
|
||||||
u32x a = 0x04040404;
|
u32 a = 0x04040404;
|
||||||
|
|
||||||
__local u32 *ptr = (__local u32 *) rc4_key->S;
|
__local u32 *ptr = (__local u32 *) rc4_key->S;
|
||||||
|
|
||||||
@ -88,7 +86,7 @@ static void rc4_init_16 (__local RC4_KEY *rc4_key, const u32x data[4])
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static u8 rc4_next_16 (__local RC4_KEY *rc4_key, u8 i, u8 j, const u32x in[4], u32x out[4])
|
static u8 rc4_next_16 (__local RC4_KEY *rc4_key, u8 i, u8 j, const u32 in[4], u32 out[4])
|
||||||
{
|
{
|
||||||
#pragma unroll
|
#pragma unroll
|
||||||
for (u32 k = 0; k < 4; k++)
|
for (u32 k = 0; k < 4; k++)
|
||||||
@ -139,29 +137,29 @@ static u8 rc4_next_16 (__local RC4_KEY *rc4_key, u8 i, u8 j, const u32x in[4], u
|
|||||||
return j;
|
return j;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void md5_transform (const u32x w0[4], const u32x w1[4], const u32x w2[4], const u32x w3[4], u32x digest[4])
|
static void md5_transform (const u32 w0[4], const u32 w1[4], const u32 w2[4], const u32 w3[4], u32 digest[4])
|
||||||
{
|
{
|
||||||
u32x a = digest[0];
|
u32 a = digest[0];
|
||||||
u32x b = digest[1];
|
u32 b = digest[1];
|
||||||
u32x c = digest[2];
|
u32 c = digest[2];
|
||||||
u32x d = digest[3];
|
u32 d = digest[3];
|
||||||
|
|
||||||
u32x w0_t = w0[0];
|
u32 w0_t = w0[0];
|
||||||
u32x w1_t = w0[1];
|
u32 w1_t = w0[1];
|
||||||
u32x w2_t = w0[2];
|
u32 w2_t = w0[2];
|
||||||
u32x w3_t = w0[3];
|
u32 w3_t = w0[3];
|
||||||
u32x w4_t = w1[0];
|
u32 w4_t = w1[0];
|
||||||
u32x w5_t = w1[1];
|
u32 w5_t = w1[1];
|
||||||
u32x w6_t = w1[2];
|
u32 w6_t = w1[2];
|
||||||
u32x w7_t = w1[3];
|
u32 w7_t = w1[3];
|
||||||
u32x w8_t = w2[0];
|
u32 w8_t = w2[0];
|
||||||
u32x w9_t = w2[1];
|
u32 w9_t = w2[1];
|
||||||
u32x wa_t = w2[2];
|
u32 wa_t = w2[2];
|
||||||
u32x wb_t = w2[3];
|
u32 wb_t = w2[3];
|
||||||
u32x wc_t = w3[0];
|
u32 wc_t = w3[0];
|
||||||
u32x wd_t = w3[1];
|
u32 wd_t = w3[1];
|
||||||
u32x we_t = w3[2];
|
u32 we_t = w3[2];
|
||||||
u32x wf_t = w3[3];
|
u32 wf_t = w3[3];
|
||||||
|
|
||||||
MD5_STEP (MD5_Fo, a, b, c, d, w0_t, MD5C00, MD5S00);
|
MD5_STEP (MD5_Fo, a, b, c, d, w0_t, MD5C00, MD5S00);
|
||||||
MD5_STEP (MD5_Fo, d, a, b, c, w1_t, MD5C01, MD5S01);
|
MD5_STEP (MD5_Fo, d, a, b, c, w1_t, MD5C01, MD5S01);
|
||||||
@ -269,16 +267,16 @@ static void m09710m (__local RC4_KEY rc4_keys[64], u32 w0[4], u32 w1[4], u32 w2[
|
|||||||
|
|
||||||
for (u32 il_pos = 0; il_pos < bfs_cnt; il_pos += VECT_SIZE)
|
for (u32 il_pos = 0; il_pos < bfs_cnt; il_pos += VECT_SIZE)
|
||||||
{
|
{
|
||||||
const u32x w0r = w0r_create_bft (bfs_buf, il_pos);
|
const u32 w0r = w0r_create_bft (bfs_buf, il_pos);
|
||||||
|
|
||||||
const u32x w0lr = w0l | w0r;
|
const u32 w0lr = w0l | w0r;
|
||||||
|
|
||||||
// first md5 to generate RC4 128 bit key
|
// first md5 to generate RC4 128 bit key
|
||||||
|
|
||||||
u32x w0_t[4];
|
u32 w0_t[4];
|
||||||
u32x w1_t[4];
|
u32 w1_t[4];
|
||||||
u32x w2_t[4];
|
u32 w2_t[4];
|
||||||
u32x w3_t[4];
|
u32 w3_t[4];
|
||||||
|
|
||||||
w0_t[0] = w0lr;
|
w0_t[0] = w0lr;
|
||||||
w0_t[1] = w0[1] & 0xff;
|
w0_t[1] = w0[1] & 0xff;
|
||||||
@ -297,7 +295,7 @@ static void m09710m (__local RC4_KEY rc4_keys[64], u32 w0[4], u32 w1[4], u32 w2[
|
|||||||
w3_t[2] = 9 * 8;
|
w3_t[2] = 9 * 8;
|
||||||
w3_t[3] = 0;
|
w3_t[3] = 0;
|
||||||
|
|
||||||
u32x digest[4];
|
u32 digest[4];
|
||||||
|
|
||||||
digest[0] = MD5M_A;
|
digest[0] = MD5M_A;
|
||||||
digest[1] = MD5M_B;
|
digest[1] = MD5M_B;
|
||||||
@ -308,7 +306,7 @@ static void m09710m (__local RC4_KEY rc4_keys[64], u32 w0[4], u32 w1[4], u32 w2[
|
|||||||
|
|
||||||
// now the RC4 part
|
// now the RC4 part
|
||||||
|
|
||||||
u32x key[4];
|
u32 key[4];
|
||||||
|
|
||||||
key[0] = digest[0];
|
key[0] = digest[0];
|
||||||
key[1] = digest[1];
|
key[1] = digest[1];
|
||||||
@ -317,7 +315,7 @@ static void m09710m (__local RC4_KEY rc4_keys[64], u32 w0[4], u32 w1[4], u32 w2[
|
|||||||
|
|
||||||
rc4_init_16 (rc4_key, key);
|
rc4_init_16 (rc4_key, key);
|
||||||
|
|
||||||
u32x out[4];
|
u32 out[4];
|
||||||
|
|
||||||
u8 j = rc4_next_16 (rc4_key, 0, 0, encryptedVerifier, out);
|
u8 j = rc4_next_16 (rc4_key, 0, 0, encryptedVerifier, out);
|
||||||
|
|
||||||
@ -395,16 +393,16 @@ static void m09710s (__local RC4_KEY rc4_keys[64], u32 w0[4], u32 w1[4], u32 w2[
|
|||||||
|
|
||||||
for (u32 il_pos = 0; il_pos < bfs_cnt; il_pos += VECT_SIZE)
|
for (u32 il_pos = 0; il_pos < bfs_cnt; il_pos += VECT_SIZE)
|
||||||
{
|
{
|
||||||
const u32x w0r = w0r_create_bft (bfs_buf, il_pos);
|
const u32 w0r = w0r_create_bft (bfs_buf, il_pos);
|
||||||
|
|
||||||
const u32x w0lr = w0l | w0r;
|
const u32 w0lr = w0l | w0r;
|
||||||
|
|
||||||
// first md5 to generate RC4 128 bit key
|
// first md5 to generate RC4 128 bit key
|
||||||
|
|
||||||
u32x w0_t[4];
|
u32 w0_t[4];
|
||||||
u32x w1_t[4];
|
u32 w1_t[4];
|
||||||
u32x w2_t[4];
|
u32 w2_t[4];
|
||||||
u32x w3_t[4];
|
u32 w3_t[4];
|
||||||
|
|
||||||
w0_t[0] = w0lr;
|
w0_t[0] = w0lr;
|
||||||
w0_t[1] = w0[1] & 0xff;
|
w0_t[1] = w0[1] & 0xff;
|
||||||
@ -423,7 +421,7 @@ static void m09710s (__local RC4_KEY rc4_keys[64], u32 w0[4], u32 w1[4], u32 w2[
|
|||||||
w3_t[2] = 9 * 8;
|
w3_t[2] = 9 * 8;
|
||||||
w3_t[3] = 0;
|
w3_t[3] = 0;
|
||||||
|
|
||||||
u32x digest[4];
|
u32 digest[4];
|
||||||
|
|
||||||
digest[0] = MD5M_A;
|
digest[0] = MD5M_A;
|
||||||
digest[1] = MD5M_B;
|
digest[1] = MD5M_B;
|
||||||
@ -434,7 +432,7 @@ static void m09710s (__local RC4_KEY rc4_keys[64], u32 w0[4], u32 w1[4], u32 w2[
|
|||||||
|
|
||||||
// now the RC4 part
|
// now the RC4 part
|
||||||
|
|
||||||
u32x key[4];
|
u32 key[4];
|
||||||
|
|
||||||
key[0] = digest[0];
|
key[0] = digest[0];
|
||||||
key[1] = digest[1];
|
key[1] = digest[1];
|
||||||
@ -443,7 +441,7 @@ static void m09710s (__local RC4_KEY rc4_keys[64], u32 w0[4], u32 w1[4], u32 w2[
|
|||||||
|
|
||||||
rc4_init_16 (rc4_key, key);
|
rc4_init_16 (rc4_key, key);
|
||||||
|
|
||||||
u32x out[4];
|
u32 out[4];
|
||||||
|
|
||||||
u8 j = rc4_next_16 (rc4_key, 0, 0, encryptedVerifier, out);
|
u8 j = rc4_next_16 (rc4_key, 0, 0, encryptedVerifier, out);
|
||||||
|
|
||||||
|
@ -5,8 +5,6 @@
|
|||||||
|
|
||||||
#define _OLDOFFICE34_
|
#define _OLDOFFICE34_
|
||||||
|
|
||||||
#define NEW_SIMD_CODE
|
|
||||||
|
|
||||||
#include "include/constants.h"
|
#include "include/constants.h"
|
||||||
#include "include/kernel_vendor.h"
|
#include "include/kernel_vendor.h"
|
||||||
|
|
||||||
@ -37,10 +35,10 @@ static void swap (__local RC4_KEY *rc4_key, const u8 i, const u8 j)
|
|||||||
rc4_key->S[j] = tmp;
|
rc4_key->S[j] = tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void rc4_init_16 (__local RC4_KEY *rc4_key, const u32x data[4])
|
static void rc4_init_16 (__local RC4_KEY *rc4_key, const u32 data[4])
|
||||||
{
|
{
|
||||||
u32x v = 0x03020100;
|
u32 v = 0x03020100;
|
||||||
u32x a = 0x04040404;
|
u32 a = 0x04040404;
|
||||||
|
|
||||||
__local u32 *ptr = (__local u32 *) rc4_key->S;
|
__local u32 *ptr = (__local u32 *) rc4_key->S;
|
||||||
|
|
||||||
@ -56,7 +54,7 @@ static void rc4_init_16 (__local RC4_KEY *rc4_key, const u32x data[4])
|
|||||||
{
|
{
|
||||||
u32 idx = i * 16;
|
u32 idx = i * 16;
|
||||||
|
|
||||||
u32x v;
|
u32 v;
|
||||||
|
|
||||||
v = data[0];
|
v = data[0];
|
||||||
|
|
||||||
@ -88,12 +86,12 @@ static void rc4_init_16 (__local RC4_KEY *rc4_key, const u32x data[4])
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static u8 rc4_next_16 (__local RC4_KEY *rc4_key, u8 i, u8 j, const u32x in[4], u32x out[4])
|
static u8 rc4_next_16 (__local RC4_KEY *rc4_key, u8 i, u8 j, const u32 in[4], u32 out[4])
|
||||||
{
|
{
|
||||||
#pragma unroll
|
#pragma unroll
|
||||||
for (u32 k = 0; k < 4; k++)
|
for (u32 k = 0; k < 4; k++)
|
||||||
{
|
{
|
||||||
u32x xor4 = 0;
|
u32 xor4 = 0;
|
||||||
|
|
||||||
u8 idx;
|
u8 idx;
|
||||||
|
|
||||||
@ -139,30 +137,30 @@ static u8 rc4_next_16 (__local RC4_KEY *rc4_key, u8 i, u8 j, const u32x in[4], u
|
|||||||
return j;
|
return j;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sha1_transform (const u32x w0[4], const u32x w1[4], const u32x w2[4], const u32x w3[4], u32x digest[5])
|
static void sha1_transform (const u32 w0[4], const u32 w1[4], const u32 w2[4], const u32 w3[4], u32 digest[5])
|
||||||
{
|
{
|
||||||
u32x A = digest[0];
|
u32 A = digest[0];
|
||||||
u32x B = digest[1];
|
u32 B = digest[1];
|
||||||
u32x C = digest[2];
|
u32 C = digest[2];
|
||||||
u32x D = digest[3];
|
u32 D = digest[3];
|
||||||
u32x E = digest[4];
|
u32 E = digest[4];
|
||||||
|
|
||||||
u32x w0_t = w0[0];
|
u32 w0_t = w0[0];
|
||||||
u32x w1_t = w0[1];
|
u32 w1_t = w0[1];
|
||||||
u32x w2_t = w0[2];
|
u32 w2_t = w0[2];
|
||||||
u32x w3_t = w0[3];
|
u32 w3_t = w0[3];
|
||||||
u32x w4_t = w1[0];
|
u32 w4_t = w1[0];
|
||||||
u32x w5_t = w1[1];
|
u32 w5_t = w1[1];
|
||||||
u32x w6_t = w1[2];
|
u32 w6_t = w1[2];
|
||||||
u32x w7_t = w1[3];
|
u32 w7_t = w1[3];
|
||||||
u32x w8_t = w2[0];
|
u32 w8_t = w2[0];
|
||||||
u32x w9_t = w2[1];
|
u32 w9_t = w2[1];
|
||||||
u32x wa_t = w2[2];
|
u32 wa_t = w2[2];
|
||||||
u32x wb_t = w2[3];
|
u32 wb_t = w2[3];
|
||||||
u32x wc_t = w3[0];
|
u32 wc_t = w3[0];
|
||||||
u32x wd_t = w3[1];
|
u32 wd_t = w3[1];
|
||||||
u32x we_t = w3[2];
|
u32 we_t = w3[2];
|
||||||
u32x wf_t = w3[3];
|
u32 wf_t = w3[3];
|
||||||
|
|
||||||
#undef K
|
#undef K
|
||||||
#define K SHA1C00
|
#define K SHA1C00
|
||||||
@ -314,14 +312,14 @@ static void m09800m (__local RC4_KEY rc4_keys[64], u32 w0[4], u32 w1[4], u32 w2[
|
|||||||
|
|
||||||
for (u32 il_pos = 0; il_pos < bfs_cnt; il_pos += VECT_SIZE)
|
for (u32 il_pos = 0; il_pos < bfs_cnt; il_pos += VECT_SIZE)
|
||||||
{
|
{
|
||||||
const u32x w0r = w0r_create_bft (bfs_buf, il_pos);
|
const u32 w0r = w0r_create_bft (bfs_buf, il_pos);
|
||||||
|
|
||||||
const u32x w0lr = w0l | w0r;
|
const u32 w0lr = w0l | w0r;
|
||||||
|
|
||||||
u32x w0_t[4];
|
u32 w0_t[4];
|
||||||
u32x w1_t[4];
|
u32 w1_t[4];
|
||||||
u32x w2_t[4];
|
u32 w2_t[4];
|
||||||
u32x w3_t[4];
|
u32 w3_t[4];
|
||||||
|
|
||||||
w0_t[0] = salt_buf[0];
|
w0_t[0] = salt_buf[0];
|
||||||
w0_t[1] = salt_buf[1];
|
w0_t[1] = salt_buf[1];
|
||||||
@ -340,7 +338,7 @@ static void m09800m (__local RC4_KEY rc4_keys[64], u32 w0[4], u32 w1[4], u32 w2[
|
|||||||
w3_t[2] = 0;
|
w3_t[2] = 0;
|
||||||
w3_t[3] = pw_salt_len * 8;
|
w3_t[3] = pw_salt_len * 8;
|
||||||
|
|
||||||
u32x digest[5];
|
u32 digest[5];
|
||||||
|
|
||||||
digest[0] = SHA1M_A;
|
digest[0] = SHA1M_A;
|
||||||
digest[1] = SHA1M_B;
|
digest[1] = SHA1M_B;
|
||||||
@ -375,7 +373,7 @@ static void m09800m (__local RC4_KEY rc4_keys[64], u32 w0[4], u32 w1[4], u32 w2[
|
|||||||
|
|
||||||
sha1_transform (w0_t, w1_t, w2_t, w3_t, digest);
|
sha1_transform (w0_t, w1_t, w2_t, w3_t, digest);
|
||||||
|
|
||||||
u32x key[4];
|
u32 key[4];
|
||||||
|
|
||||||
key[0] = swap32 (digest[0]);
|
key[0] = swap32 (digest[0]);
|
||||||
key[1] = swap32 (digest[1]);
|
key[1] = swap32 (digest[1]);
|
||||||
@ -391,7 +389,7 @@ static void m09800m (__local RC4_KEY rc4_keys[64], u32 w0[4], u32 w1[4], u32 w2[
|
|||||||
|
|
||||||
rc4_init_16 (rc4_key, key);
|
rc4_init_16 (rc4_key, key);
|
||||||
|
|
||||||
u32x out[4];
|
u32 out[4];
|
||||||
|
|
||||||
u8 j = rc4_next_16 (rc4_key, 0, 0, encryptedVerifier, out);
|
u8 j = rc4_next_16 (rc4_key, 0, 0, encryptedVerifier, out);
|
||||||
|
|
||||||
@ -490,14 +488,14 @@ static void m09800s (__local RC4_KEY rc4_keys[64], u32 w0[4], u32 w1[4], u32 w2[
|
|||||||
|
|
||||||
for (u32 il_pos = 0; il_pos < bfs_cnt; il_pos += VECT_SIZE)
|
for (u32 il_pos = 0; il_pos < bfs_cnt; il_pos += VECT_SIZE)
|
||||||
{
|
{
|
||||||
const u32x w0r = w0r_create_bft (bfs_buf, il_pos);
|
const u32 w0r = w0r_create_bft (bfs_buf, il_pos);
|
||||||
|
|
||||||
const u32x w0lr = w0l | w0r;
|
const u32 w0lr = w0l | w0r;
|
||||||
|
|
||||||
u32x w0_t[4];
|
u32 w0_t[4];
|
||||||
u32x w1_t[4];
|
u32 w1_t[4];
|
||||||
u32x w2_t[4];
|
u32 w2_t[4];
|
||||||
u32x w3_t[4];
|
u32 w3_t[4];
|
||||||
|
|
||||||
w0_t[0] = salt_buf[0];
|
w0_t[0] = salt_buf[0];
|
||||||
w0_t[1] = salt_buf[1];
|
w0_t[1] = salt_buf[1];
|
||||||
@ -516,7 +514,7 @@ static void m09800s (__local RC4_KEY rc4_keys[64], u32 w0[4], u32 w1[4], u32 w2[
|
|||||||
w3_t[2] = 0;
|
w3_t[2] = 0;
|
||||||
w3_t[3] = pw_salt_len * 8;
|
w3_t[3] = pw_salt_len * 8;
|
||||||
|
|
||||||
u32x digest[5];
|
u32 digest[5];
|
||||||
|
|
||||||
digest[0] = SHA1M_A;
|
digest[0] = SHA1M_A;
|
||||||
digest[1] = SHA1M_B;
|
digest[1] = SHA1M_B;
|
||||||
@ -551,7 +549,7 @@ static void m09800s (__local RC4_KEY rc4_keys[64], u32 w0[4], u32 w1[4], u32 w2[
|
|||||||
|
|
||||||
sha1_transform (w0_t, w1_t, w2_t, w3_t, digest);
|
sha1_transform (w0_t, w1_t, w2_t, w3_t, digest);
|
||||||
|
|
||||||
u32x key[4];
|
u32 key[4];
|
||||||
|
|
||||||
key[0] = swap32 (digest[0]);
|
key[0] = swap32 (digest[0]);
|
||||||
key[1] = swap32 (digest[1]);
|
key[1] = swap32 (digest[1]);
|
||||||
@ -567,7 +565,7 @@ static void m09800s (__local RC4_KEY rc4_keys[64], u32 w0[4], u32 w1[4], u32 w2[
|
|||||||
|
|
||||||
rc4_init_16 (rc4_key, key);
|
rc4_init_16 (rc4_key, key);
|
||||||
|
|
||||||
u32x out[4];
|
u32 out[4];
|
||||||
|
|
||||||
u8 j = rc4_next_16 (rc4_key, 0, 0, encryptedVerifier, out);
|
u8 j = rc4_next_16 (rc4_key, 0, 0, encryptedVerifier, out);
|
||||||
|
|
||||||
|
@ -5,8 +5,6 @@
|
|||||||
|
|
||||||
#define _OLDOFFICE34_
|
#define _OLDOFFICE34_
|
||||||
|
|
||||||
#define NEW_SIMD_CODE
|
|
||||||
|
|
||||||
#include "include/constants.h"
|
#include "include/constants.h"
|
||||||
#include "include/kernel_vendor.h"
|
#include "include/kernel_vendor.h"
|
||||||
|
|
||||||
@ -37,10 +35,10 @@ static void swap (__local RC4_KEY *rc4_key, const u8 i, const u8 j)
|
|||||||
rc4_key->S[j] = tmp;
|
rc4_key->S[j] = tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void rc4_init_16 (__local RC4_KEY *rc4_key, const u32x data[4])
|
static void rc4_init_16 (__local RC4_KEY *rc4_key, const u32 data[4])
|
||||||
{
|
{
|
||||||
u32x v = 0x03020100;
|
u32 v = 0x03020100;
|
||||||
u32x a = 0x04040404;
|
u32 a = 0x04040404;
|
||||||
|
|
||||||
__local u32 *ptr = (__local u32 *) rc4_key->S;
|
__local u32 *ptr = (__local u32 *) rc4_key->S;
|
||||||
|
|
||||||
@ -56,7 +54,7 @@ static void rc4_init_16 (__local RC4_KEY *rc4_key, const u32x data[4])
|
|||||||
{
|
{
|
||||||
u32 idx = i * 16;
|
u32 idx = i * 16;
|
||||||
|
|
||||||
u32x v;
|
u32 v;
|
||||||
|
|
||||||
v = data[0];
|
v = data[0];
|
||||||
|
|
||||||
@ -88,12 +86,12 @@ static void rc4_init_16 (__local RC4_KEY *rc4_key, const u32x data[4])
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static u8 rc4_next_16 (__local RC4_KEY *rc4_key, u8 i, u8 j, const u32x in[4], u32x out[4])
|
static u8 rc4_next_16 (__local RC4_KEY *rc4_key, u8 i, u8 j, const u32 in[4], u32 out[4])
|
||||||
{
|
{
|
||||||
#pragma unroll
|
#pragma unroll
|
||||||
for (u32 k = 0; k < 4; k++)
|
for (u32 k = 0; k < 4; k++)
|
||||||
{
|
{
|
||||||
u32x xor4 = 0;
|
u32 xor4 = 0;
|
||||||
|
|
||||||
u8 idx;
|
u8 idx;
|
||||||
|
|
||||||
@ -139,30 +137,30 @@ static u8 rc4_next_16 (__local RC4_KEY *rc4_key, u8 i, u8 j, const u32x in[4], u
|
|||||||
return j;
|
return j;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sha1_transform (const u32x w0[4], const u32x w1[4], const u32x w2[4], const u32x w3[4], u32x digest[5])
|
static void sha1_transform (const u32 w0[4], const u32 w1[4], const u32 w2[4], const u32 w3[4], u32 digest[5])
|
||||||
{
|
{
|
||||||
u32x A = digest[0];
|
u32 A = digest[0];
|
||||||
u32x B = digest[1];
|
u32 B = digest[1];
|
||||||
u32x C = digest[2];
|
u32 C = digest[2];
|
||||||
u32x D = digest[3];
|
u32 D = digest[3];
|
||||||
u32x E = digest[4];
|
u32 E = digest[4];
|
||||||
|
|
||||||
u32x w0_t = w0[0];
|
u32 w0_t = w0[0];
|
||||||
u32x w1_t = w0[1];
|
u32 w1_t = w0[1];
|
||||||
u32x w2_t = w0[2];
|
u32 w2_t = w0[2];
|
||||||
u32x w3_t = w0[3];
|
u32 w3_t = w0[3];
|
||||||
u32x w4_t = w1[0];
|
u32 w4_t = w1[0];
|
||||||
u32x w5_t = w1[1];
|
u32 w5_t = w1[1];
|
||||||
u32x w6_t = w1[2];
|
u32 w6_t = w1[2];
|
||||||
u32x w7_t = w1[3];
|
u32 w7_t = w1[3];
|
||||||
u32x w8_t = w2[0];
|
u32 w8_t = w2[0];
|
||||||
u32x w9_t = w2[1];
|
u32 w9_t = w2[1];
|
||||||
u32x wa_t = w2[2];
|
u32 wa_t = w2[2];
|
||||||
u32x wb_t = w2[3];
|
u32 wb_t = w2[3];
|
||||||
u32x wc_t = w3[0];
|
u32 wc_t = w3[0];
|
||||||
u32x wd_t = w3[1];
|
u32 wd_t = w3[1];
|
||||||
u32x we_t = w3[2];
|
u32 we_t = w3[2];
|
||||||
u32x wf_t = w3[3];
|
u32 wf_t = w3[3];
|
||||||
|
|
||||||
#undef K
|
#undef K
|
||||||
#define K SHA1C00
|
#define K SHA1C00
|
||||||
@ -299,11 +297,11 @@ static void m09810m (__local RC4_KEY rc4_keys[64], u32 w0[4], u32 w1[4], u32 w2[
|
|||||||
|
|
||||||
for (u32 il_pos = 0; il_pos < bfs_cnt; il_pos += VECT_SIZE)
|
for (u32 il_pos = 0; il_pos < bfs_cnt; il_pos += VECT_SIZE)
|
||||||
{
|
{
|
||||||
const u32x w0r = w0r_create_bft (bfs_buf, il_pos);
|
const u32 w0r = w0r_create_bft (bfs_buf, il_pos);
|
||||||
|
|
||||||
const u32x w0lr = w0l | w0r;
|
const u32 w0lr = w0l | w0r;
|
||||||
|
|
||||||
u32x key[4];
|
u32 key[4];
|
||||||
|
|
||||||
key[0] = w0lr;
|
key[0] = w0lr;
|
||||||
key[1] = w0[1] & 0xff;
|
key[1] = w0[1] & 0xff;
|
||||||
@ -312,14 +310,14 @@ static void m09810m (__local RC4_KEY rc4_keys[64], u32 w0[4], u32 w1[4], u32 w2[
|
|||||||
|
|
||||||
rc4_init_16 (rc4_key, key);
|
rc4_init_16 (rc4_key, key);
|
||||||
|
|
||||||
u32x out[4];
|
u32 out[4];
|
||||||
|
|
||||||
u8 j = rc4_next_16 (rc4_key, 0, 0, encryptedVerifier, out);
|
u8 j = rc4_next_16 (rc4_key, 0, 0, encryptedVerifier, out);
|
||||||
|
|
||||||
u32x w0_t[4];
|
u32 w0_t[4];
|
||||||
u32x w1_t[4];
|
u32 w1_t[4];
|
||||||
u32x w2_t[4];
|
u32 w2_t[4];
|
||||||
u32x w3_t[4];
|
u32 w3_t[4];
|
||||||
|
|
||||||
w0_t[0] = swap32 (out[0]);
|
w0_t[0] = swap32 (out[0]);
|
||||||
w0_t[1] = swap32 (out[1]);
|
w0_t[1] = swap32 (out[1]);
|
||||||
@ -338,7 +336,7 @@ static void m09810m (__local RC4_KEY rc4_keys[64], u32 w0[4], u32 w1[4], u32 w2[
|
|||||||
w3_t[2] = 0;
|
w3_t[2] = 0;
|
||||||
w3_t[3] = 16 * 8;
|
w3_t[3] = 16 * 8;
|
||||||
|
|
||||||
u32x digest[5];
|
u32 digest[5];
|
||||||
|
|
||||||
digest[0] = SHA1M_A;
|
digest[0] = SHA1M_A;
|
||||||
digest[1] = SHA1M_B;
|
digest[1] = SHA1M_B;
|
||||||
@ -403,11 +401,11 @@ static void m09810s (__local RC4_KEY rc4_keys[64], u32 w0[4], u32 w1[4], u32 w2[
|
|||||||
|
|
||||||
for (u32 il_pos = 0; il_pos < bfs_cnt; il_pos += VECT_SIZE)
|
for (u32 il_pos = 0; il_pos < bfs_cnt; il_pos += VECT_SIZE)
|
||||||
{
|
{
|
||||||
const u32x w0r = w0r_create_bft (bfs_buf, il_pos);
|
const u32 w0r = w0r_create_bft (bfs_buf, il_pos);
|
||||||
|
|
||||||
const u32x w0lr = w0l | w0r;
|
const u32 w0lr = w0l | w0r;
|
||||||
|
|
||||||
u32x key[4];
|
u32 key[4];
|
||||||
|
|
||||||
key[0] = w0lr;
|
key[0] = w0lr;
|
||||||
key[1] = w0[1] & 0xff;
|
key[1] = w0[1] & 0xff;
|
||||||
@ -416,14 +414,14 @@ static void m09810s (__local RC4_KEY rc4_keys[64], u32 w0[4], u32 w1[4], u32 w2[
|
|||||||
|
|
||||||
rc4_init_16 (rc4_key, key);
|
rc4_init_16 (rc4_key, key);
|
||||||
|
|
||||||
u32x out[4];
|
u32 out[4];
|
||||||
|
|
||||||
u8 j = rc4_next_16 (rc4_key, 0, 0, encryptedVerifier, out);
|
u8 j = rc4_next_16 (rc4_key, 0, 0, encryptedVerifier, out);
|
||||||
|
|
||||||
u32x w0_t[4];
|
u32 w0_t[4];
|
||||||
u32x w1_t[4];
|
u32 w1_t[4];
|
||||||
u32x w2_t[4];
|
u32 w2_t[4];
|
||||||
u32x w3_t[4];
|
u32 w3_t[4];
|
||||||
|
|
||||||
w0_t[0] = swap32 (out[0]);
|
w0_t[0] = swap32 (out[0]);
|
||||||
w0_t[1] = swap32 (out[1]);
|
w0_t[1] = swap32 (out[1]);
|
||||||
@ -442,7 +440,7 @@ static void m09810s (__local RC4_KEY rc4_keys[64], u32 w0[4], u32 w1[4], u32 w2[
|
|||||||
w3_t[2] = 0;
|
w3_t[2] = 0;
|
||||||
w3_t[3] = 16 * 8;
|
w3_t[3] = 16 * 8;
|
||||||
|
|
||||||
u32x digest[5];
|
u32 digest[5];
|
||||||
|
|
||||||
digest[0] = SHA1M_A;
|
digest[0] = SHA1M_A;
|
||||||
digest[1] = SHA1M_B;
|
digest[1] = SHA1M_B;
|
||||||
|
@ -16,9 +16,7 @@
|
|||||||
#include "include/kernel_functions.c"
|
#include "include/kernel_functions.c"
|
||||||
#include "OpenCL/types_ocl.c"
|
#include "OpenCL/types_ocl.c"
|
||||||
#include "OpenCL/common.c"
|
#include "OpenCL/common.c"
|
||||||
|
#include "OpenCL/simd.c"
|
||||||
#define COMPARE_S "OpenCL/check_single_comp4.c"
|
|
||||||
#define COMPARE_M "OpenCL/check_multi_comp4.c"
|
|
||||||
|
|
||||||
__constant u32 padding[8] =
|
__constant u32 padding[8] =
|
||||||
{
|
{
|
||||||
@ -275,7 +273,7 @@ static void m10400m (__local RC4_KEY rc4_keys[64], u32 w0[4], u32 w1[4], u32 w2[
|
|||||||
|
|
||||||
for (u32 il_pos = 0; il_pos < bfs_cnt; il_pos++)
|
for (u32 il_pos = 0; il_pos < bfs_cnt; il_pos++)
|
||||||
{
|
{
|
||||||
const u32 w0r = bfs_buf[il_pos].i;
|
const u32 w0r = w0r_create_bft (bfs_buf, il_pos);
|
||||||
|
|
||||||
w0[0] = w0l | w0r;
|
w0[0] = w0l | w0r;
|
||||||
|
|
||||||
@ -369,12 +367,7 @@ static void m10400m (__local RC4_KEY rc4_keys[64], u32 w0[4], u32 w1[4], u32 w2[
|
|||||||
|
|
||||||
rc4_next_16 (rc4_key, 0, 0, padding, out);
|
rc4_next_16 (rc4_key, 0, 0, padding, out);
|
||||||
|
|
||||||
const u32 r0 = out[0];
|
COMPARE_M_SIMD (out[0], out[1], out[2], out[3]);
|
||||||
const u32 r1 = out[1];
|
|
||||||
const u32 r2 = out[2];
|
|
||||||
const u32 r3 = out[3];
|
|
||||||
|
|
||||||
#include COMPARE_M
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -433,7 +426,7 @@ static void m10400s (__local RC4_KEY rc4_keys[64], u32 w0[4], u32 w1[4], u32 w2[
|
|||||||
|
|
||||||
for (u32 il_pos = 0; il_pos < bfs_cnt; il_pos++)
|
for (u32 il_pos = 0; il_pos < bfs_cnt; il_pos++)
|
||||||
{
|
{
|
||||||
const u32 w0r = bfs_buf[il_pos].i;
|
const u32 w0r = w0r_create_bft (bfs_buf, il_pos);
|
||||||
|
|
||||||
w0[0] = w0l | w0r;
|
w0[0] = w0l | w0r;
|
||||||
|
|
||||||
@ -527,12 +520,7 @@ static void m10400s (__local RC4_KEY rc4_keys[64], u32 w0[4], u32 w1[4], u32 w2[
|
|||||||
|
|
||||||
rc4_next_16 (rc4_key, 0, 0, padding, out);
|
rc4_next_16 (rc4_key, 0, 0, padding, out);
|
||||||
|
|
||||||
const u32 r0 = out[0];
|
COMPARE_S_SIMD (out[0], out[1], out[2], out[3]);
|
||||||
const u32 r1 = out[1];
|
|
||||||
const u32 r2 = out[2];
|
|
||||||
const u32 r3 = out[3];
|
|
||||||
|
|
||||||
#include COMPARE_S
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,8 +5,6 @@
|
|||||||
|
|
||||||
#define _MD5_
|
#define _MD5_
|
||||||
|
|
||||||
#define NEW_SIMD_CODE
|
|
||||||
|
|
||||||
#include "include/constants.h"
|
#include "include/constants.h"
|
||||||
#include "include/kernel_vendor.h"
|
#include "include/kernel_vendor.h"
|
||||||
|
|
||||||
@ -49,10 +47,10 @@ static void swap (__local RC4_KEY *rc4_key, const u8 i, const u8 j)
|
|||||||
rc4_key->S[j] = tmp;
|
rc4_key->S[j] = tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void rc4_init_16 (__local RC4_KEY *rc4_key, const u32x data[4])
|
static void rc4_init_16 (__local RC4_KEY *rc4_key, const u32 data[4])
|
||||||
{
|
{
|
||||||
u32x v = 0x03020100;
|
u32 v = 0x03020100;
|
||||||
u32x a = 0x04040404;
|
u32 a = 0x04040404;
|
||||||
|
|
||||||
__local u32 *ptr = (__local u32 *) rc4_key->S;
|
__local u32 *ptr = (__local u32 *) rc4_key->S;
|
||||||
|
|
||||||
@ -62,11 +60,11 @@ static void rc4_init_16 (__local RC4_KEY *rc4_key, const u32x data[4])
|
|||||||
ptr[i] = v; v += a;
|
ptr[i] = v; v += a;
|
||||||
}
|
}
|
||||||
|
|
||||||
const u32x d0 = data[0] >> 0;
|
const u32 d0 = data[0] >> 0;
|
||||||
const u32x d1 = data[0] >> 8;
|
const u32 d1 = data[0] >> 8;
|
||||||
const u32x d2 = data[0] >> 16;
|
const u32 d2 = data[0] >> 16;
|
||||||
const u32x d3 = data[0] >> 24;
|
const u32 d3 = data[0] >> 24;
|
||||||
const u32x d4 = data[1] >> 0;
|
const u32 d4 = data[1] >> 0;
|
||||||
|
|
||||||
u32 j = 0;
|
u32 j = 0;
|
||||||
|
|
||||||
@ -83,11 +81,11 @@ static void rc4_init_16 (__local RC4_KEY *rc4_key, const u32x data[4])
|
|||||||
j += rc4_key->S[255] + d0; swap (rc4_key, 255, j);
|
j += rc4_key->S[255] + d0; swap (rc4_key, 255, j);
|
||||||
}
|
}
|
||||||
|
|
||||||
static u8 rc4_next_16 (__local RC4_KEY *rc4_key, u8 i, u8 j, __constant u32x in[4], u32x out[4])
|
static u8 rc4_next_16 (__local RC4_KEY *rc4_key, u8 i, u8 j, __constant u32 in[4], u32 out[4])
|
||||||
{
|
{
|
||||||
for (u32 k = 0; k < 4; k++)
|
for (u32 k = 0; k < 4; k++)
|
||||||
{
|
{
|
||||||
u32x xor4 = 0;
|
u32 xor4 = 0;
|
||||||
|
|
||||||
u8 idx;
|
u8 idx;
|
||||||
|
|
||||||
@ -152,13 +150,13 @@ static void m10410m (__local RC4_KEY rc4_keys[64], u32 w0[4], u32 w1[4], u32 w2[
|
|||||||
|
|
||||||
for (u32 il_pos = 0; il_pos < bfs_cnt; il_pos += VECT_SIZE)
|
for (u32 il_pos = 0; il_pos < bfs_cnt; il_pos += VECT_SIZE)
|
||||||
{
|
{
|
||||||
const u32x w0r = w0r_create_bft (bfs_buf, il_pos);
|
const u32 w0r = w0r_create_bft (bfs_buf, il_pos);
|
||||||
|
|
||||||
const u32x w0lr = w0l | w0r;
|
const u32 w0lr = w0l | w0r;
|
||||||
|
|
||||||
// now the RC4 part
|
// now the RC4 part
|
||||||
|
|
||||||
u32x key[4];
|
u32 key[4];
|
||||||
|
|
||||||
key[0] = w0lr;
|
key[0] = w0lr;
|
||||||
key[1] = w0[1];
|
key[1] = w0[1];
|
||||||
@ -167,7 +165,7 @@ static void m10410m (__local RC4_KEY rc4_keys[64], u32 w0[4], u32 w1[4], u32 w2[
|
|||||||
|
|
||||||
rc4_init_16 (rc4_key, key);
|
rc4_init_16 (rc4_key, key);
|
||||||
|
|
||||||
u32x out[4];
|
u32 out[4];
|
||||||
|
|
||||||
rc4_next_16 (rc4_key, 0, 0, padding, out);
|
rc4_next_16 (rc4_key, 0, 0, padding, out);
|
||||||
|
|
||||||
@ -206,13 +204,13 @@ static void m10410s (__local RC4_KEY rc4_keys[64], u32 w0[4], u32 w1[4], u32 w2[
|
|||||||
|
|
||||||
for (u32 il_pos = 0; il_pos < bfs_cnt; il_pos += VECT_SIZE)
|
for (u32 il_pos = 0; il_pos < bfs_cnt; il_pos += VECT_SIZE)
|
||||||
{
|
{
|
||||||
const u32x w0r = w0r_create_bft (bfs_buf, il_pos);
|
const u32 w0r = w0r_create_bft (bfs_buf, il_pos);
|
||||||
|
|
||||||
const u32x w0lr = w0l | w0r;
|
const u32 w0lr = w0l | w0r;
|
||||||
|
|
||||||
// now the RC4 part
|
// now the RC4 part
|
||||||
|
|
||||||
u32x key[4];
|
u32 key[4];
|
||||||
|
|
||||||
key[0] = w0lr;
|
key[0] = w0lr;
|
||||||
key[1] = w0[1];
|
key[1] = w0[1];
|
||||||
@ -221,7 +219,7 @@ static void m10410s (__local RC4_KEY rc4_keys[64], u32 w0[4], u32 w1[4], u32 w2[
|
|||||||
|
|
||||||
rc4_init_16 (rc4_key, key);
|
rc4_init_16 (rc4_key, key);
|
||||||
|
|
||||||
u32x out[4];
|
u32 out[4];
|
||||||
|
|
||||||
rc4_next_16 (rc4_key, 0, 0, padding, out);
|
rc4_next_16 (rc4_key, 0, 0, padding, out);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user