1
0
mirror of https://github.com/hashcat/hashcat.git synced 2024-12-23 15:18:16 +00:00

Fix kernel m04520_a1.cl

This commit is contained in:
jsteube 2017-01-31 11:54:57 +01:00
parent b886dc3ede
commit fbae77b976

View File

@ -303,59 +303,37 @@ __kernel void m04520_m04 (__global pw_t *pws, __global const kernel_rule_t *rule
d += SHA1M_D;
e += SHA1M_E;
/**
* Prepend salt
*/
u32x t0[4];
u32x t1[4];
u32x t2[4];
u32x t3[4];
w0_t = salt_buf0[0];
w1_t = salt_buf0[1];
w2_t = salt_buf0[2];
w3_t = salt_buf0[3];
w4_t = salt_buf1[0];
w5_t = salt_buf1[1];
w6_t = salt_buf1[2];
w7_t = salt_buf1[3];
w8_t = uint_to_hex_lower8 ((a >> 24) & 255) << 0
t0[0] = uint_to_hex_lower8 ((a >> 24) & 255) << 0
| uint_to_hex_lower8 ((a >> 16) & 255) << 16;
w9_t = uint_to_hex_lower8 ((a >> 8) & 255) << 0
t0[1] = uint_to_hex_lower8 ((a >> 8) & 255) << 0
| uint_to_hex_lower8 ((a >> 0) & 255) << 16;
wa_t = uint_to_hex_lower8 ((b >> 24) & 255) << 0
t0[2] = uint_to_hex_lower8 ((b >> 24) & 255) << 0
| uint_to_hex_lower8 ((b >> 16) & 255) << 16;
wb_t = uint_to_hex_lower8 ((b >> 8) & 255) << 0
t0[3] = uint_to_hex_lower8 ((b >> 8) & 255) << 0
| uint_to_hex_lower8 ((b >> 0) & 255) << 16;
wc_t = uint_to_hex_lower8 ((c >> 24) & 255) << 0
t1[0] = uint_to_hex_lower8 ((c >> 24) & 255) << 0
| uint_to_hex_lower8 ((c >> 16) & 255) << 16;
wd_t = uint_to_hex_lower8 ((c >> 8) & 255) << 0
t1[1] = uint_to_hex_lower8 ((c >> 8) & 255) << 0
| uint_to_hex_lower8 ((c >> 0) & 255) << 16;
we_t = uint_to_hex_lower8 ((d >> 24) & 255) << 0
t1[2] = uint_to_hex_lower8 ((d >> 24) & 255) << 0
| uint_to_hex_lower8 ((d >> 16) & 255) << 16;
wf_t = uint_to_hex_lower8 ((d >> 8) & 255) << 0
t1[3] = uint_to_hex_lower8 ((d >> 8) & 255) << 0
| uint_to_hex_lower8 ((d >> 0) & 255) << 16;
const u32x e_sav = e;
/**
* 2nd SHA1
*/
// 1st transform
w0_t = swap32 (w0_t);
w1_t = swap32 (w1_t);
w2_t = swap32 (w2_t);
w3_t = swap32 (w3_t);
w4_t = swap32 (w4_t);
w5_t = swap32 (w5_t);
w6_t = swap32 (w6_t);
w7_t = swap32 (w7_t);
w8_t = swap32 (w8_t);
w9_t = swap32 (w9_t);
wa_t = swap32 (wa_t);
wb_t = swap32 (wb_t);
wc_t = swap32 (wc_t);
wd_t = swap32 (wd_t);
we_t = swap32 (we_t);
wf_t = swap32 (wf_t);
t2[0] = uint_to_hex_lower8 ((e >> 24) & 255) << 0
| uint_to_hex_lower8 ((e >> 16) & 255) << 16;
t2[1] = uint_to_hex_lower8 ((e >> 8) & 255) << 0
| uint_to_hex_lower8 ((e >> 0) & 255) << 16;
t2[2] = 0x80;
t2[3] = 0;
t3[0] = 0;
t3[1] = 0;
t3[2] = 0;
t3[3] = 0;
a = SHA1M_A;
b = SHA1M_B;
@ -363,6 +341,49 @@ __kernel void m04520_m04 (__global pw_t *pws, __global const kernel_rule_t *rule
d = SHA1M_D;
e = SHA1M_E;
if (salt_len > 14)
{
u32x c0[4] = { 0 };
u32x c1[4] = { 0 };
u32x c2[4] = { 0 };
u32x c3[4] = { 0 };
switch_buffer_by_offset_carry_le (t0, t1, t2, t3, c0, c1, c2, c3, salt_len);
t0[0] |= salt_buf0[0];
t0[1] |= salt_buf0[1];
t0[2] |= salt_buf0[2];
t0[3] |= salt_buf0[3];
t1[0] |= salt_buf1[0];
t1[1] |= salt_buf1[1];
t1[2] |= salt_buf1[2];
t1[3] |= salt_buf1[3];
t2[0] |= salt_buf2[0];
t2[1] |= salt_buf2[1];
t2[2] |= salt_buf2[2];
t2[3] |= salt_buf2[3];
t3[0] |= salt_buf3[0];
t3[1] |= salt_buf3[1];
t3[2] |= salt_buf3[2];
t3[3] |= salt_buf3[3];
w0_t = swap32 (t0[0]);
w1_t = swap32 (t0[1]);
w2_t = swap32 (t0[2]);
w3_t = swap32 (t0[3]);
w4_t = swap32 (t1[0]);
w5_t = swap32 (t1[1]);
w6_t = swap32 (t1[2]);
w7_t = swap32 (t1[3]);
w8_t = swap32 (t2[0]);
w9_t = swap32 (t2[1]);
wa_t = swap32 (t2[2]);
wb_t = swap32 (t2[3]);
wc_t = swap32 (t3[0]);
wd_t = swap32 (t3[1]);
we_t = swap32 (t3[2]);
wf_t = swap32 (t3[3]);
#undef K
#define K SHA1C00
@ -465,36 +486,58 @@ __kernel void m04520_m04 (__global pw_t *pws, __global const kernel_rule_t *rule
d += SHA1M_D;
e += SHA1M_E;
u32x r_a = a;
u32x r_b = b;
u32x r_c = c;
u32x r_d = d;
u32x r_e = e;
t0[0] = c0[0];
t0[1] = c0[1];
t0[2] = c0[2];
t0[3] = c0[3];
t1[0] = c1[0];
t1[1] = c1[1];
t1[2] = c1[2];
t1[3] = c1[3];
t2[0] = c2[0];
t2[1] = c2[1];
t2[2] = c2[2];
t2[3] = c2[3];
t3[0] = c3[0];
t3[1] = c3[1];
t3[2] = c3[2];
t3[3] = c3[3];
}
else
{
switch_buffer_by_offset_le (t0, t1, t2, t3, salt_len);
// 2nd transform
t0[0] |= salt_buf0[0];
t0[1] |= salt_buf0[1];
t0[2] |= salt_buf0[2];
t0[3] |= salt_buf0[3];
}
w0_t = uint_to_hex_lower8 ((e_sav >> 24) & 255) << 0
| uint_to_hex_lower8 ((e_sav >> 16) & 255) << 16;
w1_t = uint_to_hex_lower8 ((e_sav >> 8) & 255) << 0
| uint_to_hex_lower8 ((e_sav >> 0) & 255) << 16;
w2_t = 0x80000000;
w3_t = 0;
w4_t = 0;
w5_t = 0;
w6_t = 0;
w7_t = 0;
w8_t = 0;
w9_t = 0;
wa_t = 0;
wb_t = 0;
wc_t = 0;
wd_t = 0;
// final round
const u32x r_a = a;
const u32x r_b = b;
const u32x r_c = c;
const u32x r_d = d;
const u32x r_e = e;
w0_t = swap32 (t0[0]);
w1_t = swap32 (t0[1]);
w2_t = swap32 (t0[2]);
w3_t = swap32 (t0[3]);
w4_t = swap32 (t1[0]);
w5_t = swap32 (t1[1]);
w6_t = swap32 (t1[2]);
w7_t = swap32 (t1[3]);
w8_t = swap32 (t2[0]);
w9_t = swap32 (t2[1]);
wa_t = swap32 (t2[2]);
wb_t = swap32 (t2[3]);
wc_t = swap32 (t3[0]);
wd_t = swap32 (t3[1]);
we_t = 0;
wf_t = (salt_len + 40) * 8;
w0_t = swap32 (w0_t);
w1_t = swap32 (w1_t);
#undef K
#define K SHA1C00
@ -898,59 +941,37 @@ __kernel void m04520_s04 (__global pw_t *pws, __global const kernel_rule_t *rule
d += SHA1M_D;
e += SHA1M_E;
/**
* Prepend salt
*/
u32x t0[4];
u32x t1[4];
u32x t2[4];
u32x t3[4];
w0_t = salt_buf0[0];
w1_t = salt_buf0[1];
w2_t = salt_buf0[2];
w3_t = salt_buf0[3];
w4_t = salt_buf1[0];
w5_t = salt_buf1[1];
w6_t = salt_buf1[2];
w7_t = salt_buf1[3];
w8_t = uint_to_hex_lower8 ((a >> 24) & 255) << 0
t0[0] = uint_to_hex_lower8 ((a >> 24) & 255) << 0
| uint_to_hex_lower8 ((a >> 16) & 255) << 16;
w9_t = uint_to_hex_lower8 ((a >> 8) & 255) << 0
t0[1] = uint_to_hex_lower8 ((a >> 8) & 255) << 0
| uint_to_hex_lower8 ((a >> 0) & 255) << 16;
wa_t = uint_to_hex_lower8 ((b >> 24) & 255) << 0
t0[2] = uint_to_hex_lower8 ((b >> 24) & 255) << 0
| uint_to_hex_lower8 ((b >> 16) & 255) << 16;
wb_t = uint_to_hex_lower8 ((b >> 8) & 255) << 0
t0[3] = uint_to_hex_lower8 ((b >> 8) & 255) << 0
| uint_to_hex_lower8 ((b >> 0) & 255) << 16;
wc_t = uint_to_hex_lower8 ((c >> 24) & 255) << 0
t1[0] = uint_to_hex_lower8 ((c >> 24) & 255) << 0
| uint_to_hex_lower8 ((c >> 16) & 255) << 16;
wd_t = uint_to_hex_lower8 ((c >> 8) & 255) << 0
t1[1] = uint_to_hex_lower8 ((c >> 8) & 255) << 0
| uint_to_hex_lower8 ((c >> 0) & 255) << 16;
we_t = uint_to_hex_lower8 ((d >> 24) & 255) << 0
t1[2] = uint_to_hex_lower8 ((d >> 24) & 255) << 0
| uint_to_hex_lower8 ((d >> 16) & 255) << 16;
wf_t = uint_to_hex_lower8 ((d >> 8) & 255) << 0
t1[3] = uint_to_hex_lower8 ((d >> 8) & 255) << 0
| uint_to_hex_lower8 ((d >> 0) & 255) << 16;
const u32x e_sav = e;
/**
* 2nd SHA1
*/
// 1st transform
w0_t = swap32 (w0_t);
w1_t = swap32 (w1_t);
w2_t = swap32 (w2_t);
w3_t = swap32 (w3_t);
w4_t = swap32 (w4_t);
w5_t = swap32 (w5_t);
w6_t = swap32 (w6_t);
w7_t = swap32 (w7_t);
w8_t = swap32 (w8_t);
w9_t = swap32 (w9_t);
wa_t = swap32 (wa_t);
wb_t = swap32 (wb_t);
wc_t = swap32 (wc_t);
wd_t = swap32 (wd_t);
we_t = swap32 (we_t);
wf_t = swap32 (wf_t);
t2[0] = uint_to_hex_lower8 ((e >> 24) & 255) << 0
| uint_to_hex_lower8 ((e >> 16) & 255) << 16;
t2[1] = uint_to_hex_lower8 ((e >> 8) & 255) << 0
| uint_to_hex_lower8 ((e >> 0) & 255) << 16;
t2[2] = 0x80;
t2[3] = 0;
t3[0] = 0;
t3[1] = 0;
t3[2] = 0;
t3[3] = 0;
a = SHA1M_A;
b = SHA1M_B;
@ -958,6 +979,49 @@ __kernel void m04520_s04 (__global pw_t *pws, __global const kernel_rule_t *rule
d = SHA1M_D;
e = SHA1M_E;
if (salt_len > 14)
{
u32x c0[4] = { 0 };
u32x c1[4] = { 0 };
u32x c2[4] = { 0 };
u32x c3[4] = { 0 };
switch_buffer_by_offset_carry_le (t0, t1, t2, t3, c0, c1, c2, c3, salt_len);
t0[0] |= salt_buf0[0];
t0[1] |= salt_buf0[1];
t0[2] |= salt_buf0[2];
t0[3] |= salt_buf0[3];
t1[0] |= salt_buf1[0];
t1[1] |= salt_buf1[1];
t1[2] |= salt_buf1[2];
t1[3] |= salt_buf1[3];
t2[0] |= salt_buf2[0];
t2[1] |= salt_buf2[1];
t2[2] |= salt_buf2[2];
t2[3] |= salt_buf2[3];
t3[0] |= salt_buf3[0];
t3[1] |= salt_buf3[1];
t3[2] |= salt_buf3[2];
t3[3] |= salt_buf3[3];
w0_t = swap32 (t0[0]);
w1_t = swap32 (t0[1]);
w2_t = swap32 (t0[2]);
w3_t = swap32 (t0[3]);
w4_t = swap32 (t1[0]);
w5_t = swap32 (t1[1]);
w6_t = swap32 (t1[2]);
w7_t = swap32 (t1[3]);
w8_t = swap32 (t2[0]);
w9_t = swap32 (t2[1]);
wa_t = swap32 (t2[2]);
wb_t = swap32 (t2[3]);
wc_t = swap32 (t3[0]);
wd_t = swap32 (t3[1]);
we_t = swap32 (t3[2]);
wf_t = swap32 (t3[3]);
#undef K
#define K SHA1C00
@ -1060,36 +1124,58 @@ __kernel void m04520_s04 (__global pw_t *pws, __global const kernel_rule_t *rule
d += SHA1M_D;
e += SHA1M_E;
u32x r_a = a;
u32x r_b = b;
u32x r_c = c;
u32x r_d = d;
u32x r_e = e;
t0[0] = c0[0];
t0[1] = c0[1];
t0[2] = c0[2];
t0[3] = c0[3];
t1[0] = c1[0];
t1[1] = c1[1];
t1[2] = c1[2];
t1[3] = c1[3];
t2[0] = c2[0];
t2[1] = c2[1];
t2[2] = c2[2];
t2[3] = c2[3];
t3[0] = c3[0];
t3[1] = c3[1];
t3[2] = c3[2];
t3[3] = c3[3];
}
else
{
switch_buffer_by_offset_le (t0, t1, t2, t3, salt_len);
// 2nd transform
t0[0] |= salt_buf0[0];
t0[1] |= salt_buf0[1];
t0[2] |= salt_buf0[2];
t0[3] |= salt_buf0[3];
}
w0_t = uint_to_hex_lower8 ((e_sav >> 24) & 255) << 0
| uint_to_hex_lower8 ((e_sav >> 16) & 255) << 16;
w1_t = uint_to_hex_lower8 ((e_sav >> 8) & 255) << 0
| uint_to_hex_lower8 ((e_sav >> 0) & 255) << 16;
w2_t = 0x80000000;
w3_t = 0;
w4_t = 0;
w5_t = 0;
w6_t = 0;
w7_t = 0;
w8_t = 0;
w9_t = 0;
wa_t = 0;
wb_t = 0;
wc_t = 0;
wd_t = 0;
// final round
const u32x r_a = a;
const u32x r_b = b;
const u32x r_c = c;
const u32x r_d = d;
const u32x r_e = e;
w0_t = swap32 (t0[0]);
w1_t = swap32 (t0[1]);
w2_t = swap32 (t0[2]);
w3_t = swap32 (t0[3]);
w4_t = swap32 (t1[0]);
w5_t = swap32 (t1[1]);
w6_t = swap32 (t1[2]);
w7_t = swap32 (t1[3]);
w8_t = swap32 (t2[0]);
w9_t = swap32 (t2[1]);
wa_t = swap32 (t2[2]);
wb_t = swap32 (t2[3]);
wc_t = swap32 (t3[0]);
wd_t = swap32 (t3[1]);
we_t = 0;
wf_t = (salt_len + 40) * 8;
w0_t = swap32 (w0_t);
w1_t = swap32 (w1_t);
#undef K
#define K SHA1C00