1
0
mirror of https://github.com/hashcat/hashcat.git synced 2024-11-26 09:58:16 +00:00

Cleanup -m 1440 kernels to latest standard

This commit is contained in:
Jens Steube 2016-03-03 16:41:47 +01:00
parent 4ec867f9bb
commit e5c8cea390
3 changed files with 277 additions and 328 deletions

View File

@ -39,18 +39,16 @@ __kernel void m01440_m04 (__global pw_t *pws, __global kernel_rule_t *rules_buf,
if (gid >= gid_max) return;
u32 pw_buf0[4];
pw_buf0[0] = pws[gid].i[ 0];
pw_buf0[1] = pws[gid].i[ 1];
pw_buf0[2] = pws[gid].i[ 2];
pw_buf0[3] = pws[gid].i[ 3];
u32 pw_buf1[4];
pw_buf1[0] = pws[gid].i[ 4];
pw_buf1[1] = pws[gid].i[ 5];
pw_buf1[2] = pws[gid].i[ 6];
pw_buf1[3] = pws[gid].i[ 7];
pw_buf0[0] = pws[gid].i[0];
pw_buf0[1] = pws[gid].i[1];
pw_buf0[2] = pws[gid].i[2];
pw_buf0[3] = pws[gid].i[3];
pw_buf1[0] = pws[gid].i[4];
pw_buf1[1] = pws[gid].i[5];
pw_buf1[2] = pws[gid].i[6];
pw_buf1[3] = pws[gid].i[7];
const u32 pw_len = pws[gid].pw_len;
@ -59,18 +57,26 @@ __kernel void m01440_m04 (__global pw_t *pws, __global kernel_rule_t *rules_buf,
*/
u32 salt_buf0[4];
salt_buf0[0] = salt_bufs[salt_pos].salt_buf[0];
salt_buf0[1] = salt_bufs[salt_pos].salt_buf[1];
salt_buf0[2] = salt_bufs[salt_pos].salt_buf[2];
salt_buf0[3] = salt_bufs[salt_pos].salt_buf[3];
u32 salt_buf1[4];
u32 salt_buf2[4];
u32 salt_buf3[4];
salt_buf1[0] = salt_bufs[salt_pos].salt_buf[4];
salt_buf1[1] = salt_bufs[salt_pos].salt_buf[5];
salt_buf1[2] = salt_bufs[salt_pos].salt_buf[6];
salt_buf1[3] = salt_bufs[salt_pos].salt_buf[7];
salt_buf0[0] = salt_bufs[salt_pos].salt_buf[ 0];
salt_buf0[1] = salt_bufs[salt_pos].salt_buf[ 1];
salt_buf0[2] = salt_bufs[salt_pos].salt_buf[ 2];
salt_buf0[3] = salt_bufs[salt_pos].salt_buf[ 3];
salt_buf1[0] = salt_bufs[salt_pos].salt_buf[ 4];
salt_buf1[1] = salt_bufs[salt_pos].salt_buf[ 5];
salt_buf1[2] = salt_bufs[salt_pos].salt_buf[ 6];
salt_buf1[3] = salt_bufs[salt_pos].salt_buf[ 7];
salt_buf2[0] = salt_bufs[salt_pos].salt_buf[ 8];
salt_buf2[1] = salt_bufs[salt_pos].salt_buf[ 9];
salt_buf2[2] = salt_bufs[salt_pos].salt_buf[10];
salt_buf2[3] = salt_bufs[salt_pos].salt_buf[11];
salt_buf3[0] = salt_bufs[salt_pos].salt_buf[12];
salt_buf3[1] = salt_bufs[salt_pos].salt_buf[13];
salt_buf3[2] = salt_bufs[salt_pos].salt_buf[14];
salt_buf3[3] = salt_bufs[salt_pos].salt_buf[15];
const u32 salt_len = salt_bufs[salt_pos].salt_len;
@ -87,51 +93,56 @@ __kernel void m01440_m04 (__global pw_t *pws, __global kernel_rule_t *rules_buf,
const u32x out_len = apply_rules_vect (pw_buf0, pw_buf1, pw_len, rules_buf, il_pos, w0, w1);
make_unicode (w1, w2, w3);
make_unicode (w0, w0, w1);
const u32x out_len2 = out_len * 2;
/**
* prepend salt
*/
const u32x out_salt_len = (out_len * 2) + salt_len;
const u32x out_salt_len = out_len2 + salt_len;
u32x w0_t2[4];
u32x w1_t2[4];
u32x w2_t2[4];
u32x w3_t2[4];
switch_buffer_by_offset_le_VV (w0, w1, w2, w3, salt_len);
make_unicode (w0, w0_t2, w1_t2);
make_unicode (w1, w2_t2, w3_t2);
w0[0] |= salt_buf0[0];
w0[1] |= salt_buf0[1];
w0[2] |= salt_buf0[2];
w0[3] |= salt_buf0[3];
w1[0] |= salt_buf1[0];
w1[1] |= salt_buf1[1];
w1[2] |= salt_buf1[2];
w1[3] |= salt_buf1[3];
w2[0] |= salt_buf2[0];
w2[1] |= salt_buf2[1];
w2[2] |= salt_buf2[2];
w2[3] |= salt_buf2[3];
w3[0] |= salt_buf3[0];
w3[1] |= salt_buf3[1];
w3[2] |= salt_buf3[2];
w3[3] |= salt_buf3[3];
switch_buffer_by_offset_le (w0_t2, w1_t2, w2_t2, w3_t2, salt_len);
w0_t2[0] |= salt_buf0[0];
w0_t2[1] |= salt_buf0[1];
w0_t2[2] |= salt_buf0[2];
w0_t2[3] |= salt_buf0[3];
w1_t2[0] |= salt_buf1[0];
w1_t2[1] |= salt_buf1[1];
w1_t2[2] |= salt_buf1[2];
w1_t2[3] |= salt_buf1[3];
append_0x80_4x4_VV (w0_t2, w1_t2, w2_t2, w3_t2, out_salt_len);
append_0x80_4x4_VV (w0, w1, w2, w3, out_salt_len);
/**
* sha256
*/
u32x w0_t = swap32 (w0_t2[0]);
u32x w1_t = swap32 (w0_t2[1]);
u32x w2_t = swap32 (w0_t2[2]);
u32x w3_t = swap32 (w0_t2[3]);
u32x w4_t = swap32 (w1_t2[0]);
u32x w5_t = swap32 (w1_t2[1]);
u32x w6_t = swap32 (w1_t2[2]);
u32x w7_t = swap32 (w1_t2[3]);
u32x w8_t = swap32 (w2_t2[0]);
u32x w9_t = swap32 (w2_t2[1]);
u32x wa_t = swap32 (w2_t2[2]);
u32x wb_t = swap32 (w2_t2[3]);
u32x wc_t = swap32 (w3_t2[0]);
u32x wd_t = swap32 (w3_t2[1]);
u32x w0_t = swap32 (w0[0]);
u32x w1_t = swap32 (w0[1]);
u32x w2_t = swap32 (w0[2]);
u32x w3_t = swap32 (w0[3]);
u32x w4_t = swap32 (w1[0]);
u32x w5_t = swap32 (w1[1]);
u32x w6_t = swap32 (w1[2]);
u32x w7_t = swap32 (w1[3]);
u32x w8_t = swap32 (w2[0]);
u32x w9_t = swap32 (w2[1]);
u32x wa_t = swap32 (w2[2]);
u32x wb_t = swap32 (w2[3]);
u32x wc_t = swap32 (w3[0]);
u32x wd_t = swap32 (w3[1]);
u32x we_t = 0;
u32x wf_t = out_salt_len * 8;
@ -241,18 +252,16 @@ __kernel void m01440_s04 (__global pw_t *pws, __global kernel_rule_t *rules_buf,
if (gid >= gid_max) return;
u32 pw_buf0[4];
pw_buf0[0] = pws[gid].i[ 0];
pw_buf0[1] = pws[gid].i[ 1];
pw_buf0[2] = pws[gid].i[ 2];
pw_buf0[3] = pws[gid].i[ 3];
u32 pw_buf1[4];
pw_buf1[0] = pws[gid].i[ 4];
pw_buf1[1] = pws[gid].i[ 5];
pw_buf1[2] = pws[gid].i[ 6];
pw_buf1[3] = pws[gid].i[ 7];
pw_buf0[0] = pws[gid].i[0];
pw_buf0[1] = pws[gid].i[1];
pw_buf0[2] = pws[gid].i[2];
pw_buf0[3] = pws[gid].i[3];
pw_buf1[0] = pws[gid].i[4];
pw_buf1[1] = pws[gid].i[5];
pw_buf1[2] = pws[gid].i[6];
pw_buf1[3] = pws[gid].i[7];
const u32 pw_len = pws[gid].pw_len;
@ -261,18 +270,26 @@ __kernel void m01440_s04 (__global pw_t *pws, __global kernel_rule_t *rules_buf,
*/
u32 salt_buf0[4];
salt_buf0[0] = salt_bufs[salt_pos].salt_buf[0];
salt_buf0[1] = salt_bufs[salt_pos].salt_buf[1];
salt_buf0[2] = salt_bufs[salt_pos].salt_buf[2];
salt_buf0[3] = salt_bufs[salt_pos].salt_buf[3];
u32 salt_buf1[4];
u32 salt_buf2[4];
u32 salt_buf3[4];
salt_buf1[0] = salt_bufs[salt_pos].salt_buf[4];
salt_buf1[1] = salt_bufs[salt_pos].salt_buf[5];
salt_buf1[2] = salt_bufs[salt_pos].salt_buf[6];
salt_buf1[3] = salt_bufs[salt_pos].salt_buf[7];
salt_buf0[0] = salt_bufs[salt_pos].salt_buf[ 0];
salt_buf0[1] = salt_bufs[salt_pos].salt_buf[ 1];
salt_buf0[2] = salt_bufs[salt_pos].salt_buf[ 2];
salt_buf0[3] = salt_bufs[salt_pos].salt_buf[ 3];
salt_buf1[0] = salt_bufs[salt_pos].salt_buf[ 4];
salt_buf1[1] = salt_bufs[salt_pos].salt_buf[ 5];
salt_buf1[2] = salt_bufs[salt_pos].salt_buf[ 6];
salt_buf1[3] = salt_bufs[salt_pos].salt_buf[ 7];
salt_buf2[0] = salt_bufs[salt_pos].salt_buf[ 8];
salt_buf2[1] = salt_bufs[salt_pos].salt_buf[ 9];
salt_buf2[2] = salt_bufs[salt_pos].salt_buf[10];
salt_buf2[3] = salt_bufs[salt_pos].salt_buf[11];
salt_buf3[0] = salt_bufs[salt_pos].salt_buf[12];
salt_buf3[1] = salt_bufs[salt_pos].salt_buf[13];
salt_buf3[2] = salt_bufs[salt_pos].salt_buf[14];
salt_buf3[3] = salt_bufs[salt_pos].salt_buf[15];
const u32 salt_len = salt_bufs[salt_pos].salt_len;
@ -301,51 +318,56 @@ __kernel void m01440_s04 (__global pw_t *pws, __global kernel_rule_t *rules_buf,
const u32x out_len = apply_rules_vect (pw_buf0, pw_buf1, pw_len, rules_buf, il_pos, w0, w1);
make_unicode (w1, w2, w3);
make_unicode (w0, w0, w1);
const u32x out_len2 = out_len * 2;
/**
* prepend salt
*/
const u32x out_salt_len = (out_len * 2) + salt_len;
const u32x out_salt_len = out_len2 + salt_len;
u32x w0_t2[4];
u32x w1_t2[4];
u32x w2_t2[4];
u32x w3_t2[4];
switch_buffer_by_offset_le_VV (w0, w1, w2, w3, salt_len);
make_unicode (w0, w0_t2, w1_t2);
make_unicode (w1, w2_t2, w3_t2);
w0[0] |= salt_buf0[0];
w0[1] |= salt_buf0[1];
w0[2] |= salt_buf0[2];
w0[3] |= salt_buf0[3];
w1[0] |= salt_buf1[0];
w1[1] |= salt_buf1[1];
w1[2] |= salt_buf1[2];
w1[3] |= salt_buf1[3];
w2[0] |= salt_buf2[0];
w2[1] |= salt_buf2[1];
w2[2] |= salt_buf2[2];
w2[3] |= salt_buf2[3];
w3[0] |= salt_buf3[0];
w3[1] |= salt_buf3[1];
w3[2] |= salt_buf3[2];
w3[3] |= salt_buf3[3];
switch_buffer_by_offset_le (w0_t2, w1_t2, w2_t2, w3_t2, salt_len);
w0_t2[0] |= salt_buf0[0];
w0_t2[1] |= salt_buf0[1];
w0_t2[2] |= salt_buf0[2];
w0_t2[3] |= salt_buf0[3];
w1_t2[0] |= salt_buf1[0];
w1_t2[1] |= salt_buf1[1];
w1_t2[2] |= salt_buf1[2];
w1_t2[3] |= salt_buf1[3];
append_0x80_4x4_VV (w0_t2, w1_t2, w2_t2, w3_t2, out_salt_len);
append_0x80_4x4_VV (w0, w1, w2, w3, out_salt_len);
/**
* sha256
*/
u32x w0_t = swap32 (w0_t2[0]);
u32x w1_t = swap32 (w0_t2[1]);
u32x w2_t = swap32 (w0_t2[2]);
u32x w3_t = swap32 (w0_t2[3]);
u32x w4_t = swap32 (w1_t2[0]);
u32x w5_t = swap32 (w1_t2[1]);
u32x w6_t = swap32 (w1_t2[2]);
u32x w7_t = swap32 (w1_t2[3]);
u32x w8_t = swap32 (w2_t2[0]);
u32x w9_t = swap32 (w2_t2[1]);
u32x wa_t = swap32 (w2_t2[2]);
u32x wb_t = swap32 (w2_t2[3]);
u32x wc_t = swap32 (w3_t2[0]);
u32x wd_t = swap32 (w3_t2[1]);
u32x w0_t = swap32 (w0[0]);
u32x w1_t = swap32 (w0[1]);
u32x w2_t = swap32 (w0[2]);
u32x w3_t = swap32 (w0[3]);
u32x w4_t = swap32 (w1[0]);
u32x w5_t = swap32 (w1[1]);
u32x w6_t = swap32 (w1[2]);
u32x w7_t = swap32 (w1[3]);
u32x w8_t = swap32 (w2[0]);
u32x w9_t = swap32 (w2[1]);
u32x wa_t = swap32 (w2[2]);
u32x wb_t = swap32 (w2[3]);
u32x wc_t = swap32 (w3[0]);
u32x wd_t = swap32 (w3[1]);
u32x we_t = 0;
u32x wf_t = out_salt_len * 8;
@ -422,6 +444,9 @@ __kernel void m01440_s04 (__global pw_t *pws, __global kernel_rule_t *rules_buf,
wa_t = SHA256_EXPAND (w8_t, w3_t, wb_t, wa_t); SHA256_STEP (SHA256_F0o, SHA256_F1o, g, h, a, b, c, d, e, f, wa_t, SHA256C3a);
wb_t = SHA256_EXPAND (w9_t, w4_t, wc_t, wb_t); SHA256_STEP (SHA256_F0o, SHA256_F1o, f, g, h, a, b, c, d, e, wb_t, SHA256C3b);
wc_t = SHA256_EXPAND (wa_t, w5_t, wd_t, wc_t); SHA256_STEP (SHA256_F0o, SHA256_F1o, e, f, g, h, a, b, c, d, wc_t, SHA256C3c);
if (MATCHES_NONE_VS (d, search[0])) continue;
wd_t = SHA256_EXPAND (wb_t, w6_t, we_t, wd_t); SHA256_STEP (SHA256_F0o, SHA256_F1o, d, e, f, g, h, a, b, c, wd_t, SHA256C3d);
we_t = SHA256_EXPAND (wc_t, w7_t, wf_t, we_t); SHA256_STEP (SHA256_F0o, SHA256_F1o, c, d, e, f, g, h, a, b, we_t, SHA256C3e);
wf_t = SHA256_EXPAND (wd_t, w8_t, w0_t, wf_t); SHA256_STEP (SHA256_F0o, SHA256_F1o, b, c, d, e, f, g, h, a, wf_t, SHA256C3f);

View File

@ -182,7 +182,7 @@ __kernel void m01440_m04 (__global pw_t *pws, __global kernel_rule_t *rules_buf,
w3[3] |= salt_buf3[3];
/**
* sha1
* sha256
*/
u32x w0_t = swap32 (w0[0]);
@ -465,7 +465,7 @@ __kernel void m01440_s04 (__global pw_t *pws, __global kernel_rule_t *rules_buf,
w3[3] |= salt_buf3[3];
/**
* sha1
* sha256
*/
u32x w0_t = swap32 (w0[0]);

View File

@ -34,32 +34,26 @@ static void m01440m (u32 w0[4], u32 w1[4], u32 w2[4], u32 w3[4], const u32 pw_le
*/
u32 salt_buf0[4];
salt_buf0[0] = salt_bufs[salt_pos].salt_buf[ 0];
salt_buf0[1] = salt_bufs[salt_pos].salt_buf[ 1];
salt_buf0[2] = salt_bufs[salt_pos].salt_buf[ 2];
salt_buf0[3] = salt_bufs[salt_pos].salt_buf[ 3];
u32 salt_buf1[4];
salt_buf1[0] = salt_bufs[salt_pos].salt_buf[ 4];
salt_buf1[1] = salt_bufs[salt_pos].salt_buf[ 5];
salt_buf1[2] = salt_bufs[salt_pos].salt_buf[ 6];
salt_buf1[3] = salt_bufs[salt_pos].salt_buf[ 7];
u32 salt_buf2[4];
salt_buf2[0] = 0;
salt_buf2[1] = 0;
salt_buf2[2] = 0;
salt_buf2[3] = 0;
u32 salt_buf3[4];
salt_buf3[0] = 0;
salt_buf3[1] = 0;
salt_buf3[2] = 0;
salt_buf3[3] = 0;
salt_buf0[0] = swap32_S (salt_bufs[salt_pos].salt_buf[ 0]);
salt_buf0[1] = swap32_S (salt_bufs[salt_pos].salt_buf[ 1]);
salt_buf0[2] = swap32_S (salt_bufs[salt_pos].salt_buf[ 2]);
salt_buf0[3] = swap32_S (salt_bufs[salt_pos].salt_buf[ 3]);
salt_buf1[0] = swap32_S (salt_bufs[salt_pos].salt_buf[ 4]);
salt_buf1[1] = swap32_S (salt_bufs[salt_pos].salt_buf[ 5]);
salt_buf1[2] = swap32_S (salt_bufs[salt_pos].salt_buf[ 6]);
salt_buf1[3] = swap32_S (salt_bufs[salt_pos].salt_buf[ 7]);
salt_buf2[0] = swap32_S (salt_bufs[salt_pos].salt_buf[ 8]);
salt_buf2[1] = swap32_S (salt_bufs[salt_pos].salt_buf[ 9]);
salt_buf2[2] = swap32_S (salt_bufs[salt_pos].salt_buf[10]);
salt_buf2[3] = swap32_S (salt_bufs[salt_pos].salt_buf[11]);
salt_buf3[0] = swap32_S (salt_bufs[salt_pos].salt_buf[12]);
salt_buf3[1] = swap32_S (salt_bufs[salt_pos].salt_buf[13]);
salt_buf3[2] = swap32_S (salt_bufs[salt_pos].salt_buf[14]);
salt_buf3[3] = swap32_S (salt_bufs[salt_pos].salt_buf[15]);
const u32 salt_len = salt_bufs[salt_pos].salt_len;
@ -69,111 +63,79 @@ static void m01440m (u32 w0[4], u32 w1[4], u32 w2[4], u32 w3[4], const u32 pw_le
* prepend salt
*/
u32 w0_t[4];
u32 w1_t[4];
u32 w2_t[4];
u32 w3_t[4];
const u32 w0l = w0[0];
w0_t[0] = swap32_S (w0[0]);
w0_t[1] = swap32_S (w0[1]);
w0_t[2] = swap32_S (w0[2]);
w0_t[3] = swap32_S (w0[3]);
w1_t[0] = swap32_S (w1[0]);
w1_t[1] = swap32_S (w1[1]);
w1_t[2] = swap32_S (w1[2]);
w1_t[3] = swap32_S (w1[3]);
w2_t[0] = swap32_S (w2[0]);
w2_t[1] = swap32_S (w2[1]);
w2_t[2] = swap32_S (w2[2]);
w2_t[3] = swap32_S (w2[3]);
w3_t[0] = swap32_S (w3[0]);
w3_t[1] = swap32_S (w3[1]);
w3_t[2] = swap32_S (w3[2]);
w3_t[3] = swap32_S (w3[3]);
switch_buffer_by_offset_be_S (w0, w1, w2, w3, salt_len);
switch_buffer_by_offset_le_S (w0_t, w1_t, w2_t, w3_t, salt_len);
w0[0] |= salt_buf0[0];
w0[1] |= salt_buf0[1];
w0[2] |= salt_buf0[2];
w0[3] |= salt_buf0[3];
w1[0] |= salt_buf1[0];
w1[1] |= salt_buf1[1];
w1[2] |= salt_buf1[2];
w1[3] |= salt_buf1[3];
w2[0] |= salt_buf2[0];
w2[1] |= salt_buf2[1];
w2[2] |= salt_buf2[2];
w2[3] |= salt_buf2[3];
w3[0] |= salt_buf3[0];
w3[1] |= salt_buf3[1];
w3[2] |= salt_buf3[2];
w3[3] |= salt_buf3[3];
w0_t[0] |= salt_buf0[0];
w0_t[1] |= salt_buf0[1];
w0_t[2] |= salt_buf0[2];
w0_t[3] |= salt_buf0[3];
w1_t[0] |= salt_buf1[0];
w1_t[1] |= salt_buf1[1];
w1_t[2] |= salt_buf1[2];
w1_t[3] |= salt_buf1[3];
w2_t[0] |= salt_buf2[0];
w2_t[1] |= salt_buf2[1];
w2_t[2] |= salt_buf2[2];
w2_t[3] |= salt_buf2[3];
w3_t[0] |= salt_buf3[0];
w3_t[1] |= salt_buf3[1];
w3_t[2] |= salt_buf3[2];
w3_t[3] |= salt_buf3[3];
u32x t0[4];
u32x t1[4];
u32x t2[4];
u32x t3[4];
w0_t[0] = swap32_S (w0_t[0]);
w0_t[1] = swap32_S (w0_t[1]);
w0_t[2] = swap32_S (w0_t[2]);
w0_t[3] = swap32_S (w0_t[3]);
w1_t[0] = swap32_S (w1_t[0]);
w1_t[1] = swap32_S (w1_t[1]);
w1_t[2] = swap32_S (w1_t[2]);
w1_t[3] = swap32_S (w1_t[3]);
w2_t[0] = swap32_S (w2_t[0]);
w2_t[1] = swap32_S (w2_t[1]);
w2_t[2] = swap32_S (w2_t[2]);
w2_t[3] = swap32_S (w2_t[3]);
w3_t[0] = swap32_S (w3_t[0]);
w3_t[1] = swap32_S (w3_t[1]);
w3_t[2] = swap32_S (w3_t[2]);
w3_t[3] = swap32_S (w3_t[3]);
t0[0] = w0[0];
t0[1] = w0[1];
t0[2] = w0[2];
t0[3] = w0[3];
t1[0] = w1[0];
t1[1] = w1[1];
t1[2] = w1[2];
t1[3] = w1[3];
t2[0] = w2[0];
t2[1] = w2[1];
t2[2] = w2[2];
t2[3] = w2[3];
t3[0] = w3[0];
t3[1] = w3[1];
t3[2] = w3[2];
t3[3] = w3[3];
/**
* loop
*/
u32 w0l = w0[0];
for (u32 il_pos = 0; il_pos < il_cnt; il_pos += VECT_SIZE)
{
const u32x w0r = ix_create_bft (bfs_buf, il_pos);
const u32x w0lr = w0l | w0r;
u32x wx[16];
overwrite_at_be_4x4 (t0, t1, t2, t3, w0lr, salt_len);
wx[ 0] = w0_t[0];
wx[ 1] = w0_t[1];
wx[ 2] = w0_t[2];
wx[ 3] = w0_t[3];
wx[ 4] = w1_t[0];
wx[ 5] = w1_t[1];
wx[ 6] = w1_t[2];
wx[ 7] = w1_t[3];
wx[ 8] = w2_t[0];
wx[ 9] = w2_t[1];
wx[10] = w2_t[2];
wx[11] = w2_t[3];
wx[12] = w3_t[0];
wx[13] = w3_t[1];
wx[14] = w3_t[2];
wx[15] = w3_t[3];
/**
* sha256
*/
overwrite_at_be (wx, w0lr, salt_len);
u32x w0_t = wx[ 0];
u32x w1_t = wx[ 1];
u32x w2_t = wx[ 2];
u32x w3_t = wx[ 3];
u32x w4_t = wx[ 4];
u32x w5_t = wx[ 5];
u32x w6_t = wx[ 6];
u32x w7_t = wx[ 7];
u32x w8_t = wx[ 8];
u32x w9_t = wx[ 9];
u32x wa_t = wx[10];
u32x wb_t = wx[11];
u32x wc_t = wx[12];
u32x wd_t = wx[13];
u32x w0_t = t0[0];
u32x w1_t = t0[1];
u32x w2_t = t0[2];
u32x w3_t = t0[3];
u32x w4_t = t1[0];
u32x w5_t = t1[1];
u32x w6_t = t1[2];
u32x w7_t = t1[3];
u32x w8_t = t2[0];
u32x w9_t = t2[1];
u32x wa_t = t2[2];
u32x wb_t = t2[3];
u32x wc_t = t3[0];
u32x wd_t = t3[1];
u32x we_t = 0;
u32x wf_t = pw_salt_len * 8;
@ -284,32 +246,26 @@ static void m01440s (u32 w0[4], u32 w1[4], u32 w2[4], u32 w3[4], const u32 pw_le
*/
u32 salt_buf0[4];
salt_buf0[0] = salt_bufs[salt_pos].salt_buf[ 0];
salt_buf0[1] = salt_bufs[salt_pos].salt_buf[ 1];
salt_buf0[2] = salt_bufs[salt_pos].salt_buf[ 2];
salt_buf0[3] = salt_bufs[salt_pos].salt_buf[ 3];
u32 salt_buf1[4];
salt_buf1[0] = salt_bufs[salt_pos].salt_buf[ 4];
salt_buf1[1] = salt_bufs[salt_pos].salt_buf[ 5];
salt_buf1[2] = salt_bufs[salt_pos].salt_buf[ 6];
salt_buf1[3] = salt_bufs[salt_pos].salt_buf[ 7];
u32 salt_buf2[4];
salt_buf2[0] = 0;
salt_buf2[1] = 0;
salt_buf2[2] = 0;
salt_buf2[3] = 0;
u32 salt_buf3[4];
salt_buf3[0] = 0;
salt_buf3[1] = 0;
salt_buf3[2] = 0;
salt_buf3[3] = 0;
salt_buf0[0] = swap32_S (salt_bufs[salt_pos].salt_buf[ 0]);
salt_buf0[1] = swap32_S (salt_bufs[salt_pos].salt_buf[ 1]);
salt_buf0[2] = swap32_S (salt_bufs[salt_pos].salt_buf[ 2]);
salt_buf0[3] = swap32_S (salt_bufs[salt_pos].salt_buf[ 3]);
salt_buf1[0] = swap32_S (salt_bufs[salt_pos].salt_buf[ 4]);
salt_buf1[1] = swap32_S (salt_bufs[salt_pos].salt_buf[ 5]);
salt_buf1[2] = swap32_S (salt_bufs[salt_pos].salt_buf[ 6]);
salt_buf1[3] = swap32_S (salt_bufs[salt_pos].salt_buf[ 7]);
salt_buf2[0] = swap32_S (salt_bufs[salt_pos].salt_buf[ 8]);
salt_buf2[1] = swap32_S (salt_bufs[salt_pos].salt_buf[ 9]);
salt_buf2[2] = swap32_S (salt_bufs[salt_pos].salt_buf[10]);
salt_buf2[3] = swap32_S (salt_bufs[salt_pos].salt_buf[11]);
salt_buf3[0] = swap32_S (salt_bufs[salt_pos].salt_buf[12]);
salt_buf3[1] = swap32_S (salt_bufs[salt_pos].salt_buf[13]);
salt_buf3[2] = swap32_S (salt_bufs[salt_pos].salt_buf[14]);
salt_buf3[3] = swap32_S (salt_bufs[salt_pos].salt_buf[15]);
const u32 salt_len = salt_bufs[salt_pos].salt_len;
@ -319,111 +275,79 @@ static void m01440s (u32 w0[4], u32 w1[4], u32 w2[4], u32 w3[4], const u32 pw_le
* prepend salt
*/
u32 w0_t[4];
u32 w1_t[4];
u32 w2_t[4];
u32 w3_t[4];
const u32 w0l = w0[0];
w0_t[0] = swap32_S (w0[0]);
w0_t[1] = swap32_S (w0[1]);
w0_t[2] = swap32_S (w0[2]);
w0_t[3] = swap32_S (w0[3]);
w1_t[0] = swap32_S (w1[0]);
w1_t[1] = swap32_S (w1[1]);
w1_t[2] = swap32_S (w1[2]);
w1_t[3] = swap32_S (w1[3]);
w2_t[0] = swap32_S (w2[0]);
w2_t[1] = swap32_S (w2[1]);
w2_t[2] = swap32_S (w2[2]);
w2_t[3] = swap32_S (w2[3]);
w3_t[0] = swap32_S (w3[0]);
w3_t[1] = swap32_S (w3[1]);
w3_t[2] = swap32_S (w3[2]);
w3_t[3] = swap32_S (w3[3]);
switch_buffer_by_offset_be_S (w0, w1, w2, w3, salt_len);
switch_buffer_by_offset_le_S (w0_t, w1_t, w2_t, w3_t, salt_len);
w0[0] |= salt_buf0[0];
w0[1] |= salt_buf0[1];
w0[2] |= salt_buf0[2];
w0[3] |= salt_buf0[3];
w1[0] |= salt_buf1[0];
w1[1] |= salt_buf1[1];
w1[2] |= salt_buf1[2];
w1[3] |= salt_buf1[3];
w2[0] |= salt_buf2[0];
w2[1] |= salt_buf2[1];
w2[2] |= salt_buf2[2];
w2[3] |= salt_buf2[3];
w3[0] |= salt_buf3[0];
w3[1] |= salt_buf3[1];
w3[2] |= salt_buf3[2];
w3[3] |= salt_buf3[3];
w0_t[0] |= salt_buf0[0];
w0_t[1] |= salt_buf0[1];
w0_t[2] |= salt_buf0[2];
w0_t[3] |= salt_buf0[3];
w1_t[0] |= salt_buf1[0];
w1_t[1] |= salt_buf1[1];
w1_t[2] |= salt_buf1[2];
w1_t[3] |= salt_buf1[3];
w2_t[0] |= salt_buf2[0];
w2_t[1] |= salt_buf2[1];
w2_t[2] |= salt_buf2[2];
w2_t[3] |= salt_buf2[3];
w3_t[0] |= salt_buf3[0];
w3_t[1] |= salt_buf3[1];
w3_t[2] |= salt_buf3[2];
w3_t[3] |= salt_buf3[3];
u32x t0[4];
u32x t1[4];
u32x t2[4];
u32x t3[4];
w0_t[0] = swap32_S (w0_t[0]);
w0_t[1] = swap32_S (w0_t[1]);
w0_t[2] = swap32_S (w0_t[2]);
w0_t[3] = swap32_S (w0_t[3]);
w1_t[0] = swap32_S (w1_t[0]);
w1_t[1] = swap32_S (w1_t[1]);
w1_t[2] = swap32_S (w1_t[2]);
w1_t[3] = swap32_S (w1_t[3]);
w2_t[0] = swap32_S (w2_t[0]);
w2_t[1] = swap32_S (w2_t[1]);
w2_t[2] = swap32_S (w2_t[2]);
w2_t[3] = swap32_S (w2_t[3]);
w3_t[0] = swap32_S (w3_t[0]);
w3_t[1] = swap32_S (w3_t[1]);
w3_t[2] = swap32_S (w3_t[2]);
w3_t[3] = swap32_S (w3_t[3]);
t0[0] = w0[0];
t0[1] = w0[1];
t0[2] = w0[2];
t0[3] = w0[3];
t1[0] = w1[0];
t1[1] = w1[1];
t1[2] = w1[2];
t1[3] = w1[3];
t2[0] = w2[0];
t2[1] = w2[1];
t2[2] = w2[2];
t2[3] = w2[3];
t3[0] = w3[0];
t3[1] = w3[1];
t3[2] = w3[2];
t3[3] = w3[3];
/**
* loop
*/
u32 w0l = w0[0];
for (u32 il_pos = 0; il_pos < il_cnt; il_pos += VECT_SIZE)
{
const u32x w0r = ix_create_bft (bfs_buf, il_pos);
const u32x w0lr = w0l | w0r;
u32x wx[16];
overwrite_at_be_4x4 (t0, t1, t2, t3, w0lr, salt_len);
wx[ 0] = w0_t[0];
wx[ 1] = w0_t[1];
wx[ 2] = w0_t[2];
wx[ 3] = w0_t[3];
wx[ 4] = w1_t[0];
wx[ 5] = w1_t[1];
wx[ 6] = w1_t[2];
wx[ 7] = w1_t[3];
wx[ 8] = w2_t[0];
wx[ 9] = w2_t[1];
wx[10] = w2_t[2];
wx[11] = w2_t[3];
wx[12] = w3_t[0];
wx[13] = w3_t[1];
wx[14] = w3_t[2];
wx[15] = w3_t[3];
/**
* sha256
*/
overwrite_at_be (wx, w0lr, salt_len);
u32x w0_t = wx[ 0];
u32x w1_t = wx[ 1];
u32x w2_t = wx[ 2];
u32x w3_t = wx[ 3];
u32x w4_t = wx[ 4];
u32x w5_t = wx[ 5];
u32x w6_t = wx[ 6];
u32x w7_t = wx[ 7];
u32x w8_t = wx[ 8];
u32x w9_t = wx[ 9];
u32x wa_t = wx[10];
u32x wb_t = wx[11];
u32x wc_t = wx[12];
u32x wd_t = wx[13];
u32x w0_t = t0[0];
u32x w1_t = t0[1];
u32x w2_t = t0[2];
u32x w3_t = t0[3];
u32x w4_t = t1[0];
u32x w5_t = t1[1];
u32x w6_t = t1[2];
u32x w7_t = t1[3];
u32x w8_t = t2[0];
u32x w9_t = t2[1];
u32x wa_t = t2[2];
u32x wb_t = t2[3];
u32x wc_t = t3[0];
u32x wd_t = t3[1];
u32x we_t = 0;
u32x wf_t = pw_salt_len * 8;