1
mirror of https://github.com/hashcat/hashcat synced 2024-11-02 20:39:22 +01:00

Cleanup -m 80xx kernels to latest standard

This commit is contained in:
Jens Steube 2016-04-15 11:44:34 +02:00
parent 7223cc94de
commit e7ea8cb778
2 changed files with 192 additions and 223 deletions

View File

@ -297,14 +297,12 @@ __kernel void m08000_m04 (__global pw_t *pws, __global kernel_rule_t *rules_buf,
*/ */
u32 pw_buf0[4]; u32 pw_buf0[4];
u32 pw_buf1[4];
pw_buf0[0] = pws[gid].i[ 0]; pw_buf0[0] = pws[gid].i[ 0];
pw_buf0[1] = pws[gid].i[ 1]; pw_buf0[1] = pws[gid].i[ 1];
pw_buf0[2] = pws[gid].i[ 2]; pw_buf0[2] = pws[gid].i[ 2];
pw_buf0[3] = pws[gid].i[ 3]; pw_buf0[3] = pws[gid].i[ 3];
u32 pw_buf1[4];
pw_buf1[0] = pws[gid].i[ 4]; pw_buf1[0] = pws[gid].i[ 4];
pw_buf1[1] = pws[gid].i[ 5]; pw_buf1[1] = pws[gid].i[ 5];
pw_buf1[2] = pws[gid].i[ 6]; pw_buf1[2] = pws[gid].i[ 6];
@ -323,7 +321,7 @@ __kernel void m08000_m04 (__global pw_t *pws, __global kernel_rule_t *rules_buf,
u32x w2[4] = { 0 }; u32x w2[4] = { 0 };
u32x w3[4] = { 0 }; u32x w3[4] = { 0 };
const u32x out_len = apply_rules_vect (pw_buf0, pw_buf1, pw_len, rules_buf, il_pos, w0, w1); apply_rules_vect (pw_buf0, pw_buf1, pw_len, rules_buf, il_pos, w0, w1);
u32x w0_t[4]; u32x w0_t[4];
u32x w1_t[4]; u32x w1_t[4];
@ -331,7 +329,6 @@ __kernel void m08000_m04 (__global pw_t *pws, __global kernel_rule_t *rules_buf,
u32x w3_t[4]; u32x w3_t[4];
make_unicode (w0, w0_t, w1_t); make_unicode (w0, w0_t, w1_t);
make_unicode (w1, w2_t, w3_t); make_unicode (w1, w2_t, w3_t);
u32x w_t[16]; u32x w_t[16];
@ -467,14 +464,12 @@ __kernel void m08000_s04 (__global pw_t *pws, __global kernel_rule_t *rules_buf,
*/ */
u32 pw_buf0[4]; u32 pw_buf0[4];
u32 pw_buf1[4];
pw_buf0[0] = pws[gid].i[ 0]; pw_buf0[0] = pws[gid].i[ 0];
pw_buf0[1] = pws[gid].i[ 1]; pw_buf0[1] = pws[gid].i[ 1];
pw_buf0[2] = pws[gid].i[ 2]; pw_buf0[2] = pws[gid].i[ 2];
pw_buf0[3] = pws[gid].i[ 3]; pw_buf0[3] = pws[gid].i[ 3];
u32 pw_buf1[4];
pw_buf1[0] = pws[gid].i[ 4]; pw_buf1[0] = pws[gid].i[ 4];
pw_buf1[1] = pws[gid].i[ 5]; pw_buf1[1] = pws[gid].i[ 5];
pw_buf1[2] = pws[gid].i[ 6]; pw_buf1[2] = pws[gid].i[ 6];
@ -505,7 +500,7 @@ __kernel void m08000_s04 (__global pw_t *pws, __global kernel_rule_t *rules_buf,
u32x w2[4] = { 0 }; u32x w2[4] = { 0 };
u32x w3[4] = { 0 }; u32x w3[4] = { 0 };
const u32x out_len = apply_rules_vect (pw_buf0, pw_buf1, pw_len, rules_buf, il_pos, w0, w1); apply_rules_vect (pw_buf0, pw_buf1, pw_len, rules_buf, il_pos, w0, w1);
u32x w0_t[4]; u32x w0_t[4];
u32x w1_t[4]; u32x w1_t[4];
@ -513,7 +508,6 @@ __kernel void m08000_s04 (__global pw_t *pws, __global kernel_rule_t *rules_buf,
u32x w3_t[4]; u32x w3_t[4];
make_unicode (w0, w0_t, w1_t); make_unicode (w0, w0_t, w1_t);
make_unicode (w1, w2_t, w3_t); make_unicode (w1, w2_t, w3_t);
u32x w_t[16]; u32x w_t[16];

View File

@ -7,6 +7,8 @@
#define _SHA256_ #define _SHA256_
#define NEW_SIMD_CODE
#include "include/constants.h" #include "include/constants.h"
#include "include/kernel_vendor.h" #include "include/kernel_vendor.h"
@ -18,9 +20,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 k_sha256[64] = __constant u32 k_sha256[64] =
{ {
@ -42,33 +42,38 @@ __constant u32 k_sha256[64] =
SHA256C3c, SHA256C3d, SHA256C3e, SHA256C3f, SHA256C3c, SHA256C3d, SHA256C3e, SHA256C3f,
}; };
static void sha256_transform (u32 digest[8], const u32 w[16]) #define SHA256_S0_S(x) (rotl32_S ((x), 25u) ^ rotl32_S ((x), 14u) ^ SHIFT_RIGHT_32 ((x), 3u))
{ #define SHA256_S1_S(x) (rotl32_S ((x), 15u) ^ rotl32_S ((x), 13u) ^ SHIFT_RIGHT_32 ((x), 10u))
u32 a = digest[0];
u32 b = digest[1];
u32 c = digest[2];
u32 d = digest[3];
u32 e = digest[4];
u32 f = digest[5];
u32 g = digest[6];
u32 h = digest[7];
u32 w0_t = w[ 0]; #define SHA256_EXPAND_S(x,y,z,w) (SHA256_S1_S (x) + y + SHA256_S0_S (z) + w)
u32 w1_t = w[ 1];
u32 w2_t = w[ 2]; static void sha256_transform (u32x digest[8], const u32x w[16])
u32 w3_t = w[ 3]; {
u32 w4_t = w[ 4]; u32x a = digest[0];
u32 w5_t = w[ 5]; u32x b = digest[1];
u32 w6_t = w[ 6]; u32x c = digest[2];
u32 w7_t = w[ 7]; u32x d = digest[3];
u32 w8_t = w[ 8]; u32x e = digest[4];
u32 w9_t = w[ 9]; u32x f = digest[5];
u32 wa_t = w[10]; u32x g = digest[6];
u32 wb_t = w[11]; u32x h = digest[7];
u32 wc_t = w[12];
u32 wd_t = w[13]; u32x w0_t = w[ 0];
u32 we_t = w[14]; u32x w1_t = w[ 1];
u32 wf_t = w[15]; u32x w2_t = w[ 2];
u32x w3_t = w[ 3];
u32x w4_t = w[ 4];
u32x w5_t = w[ 5];
u32x w6_t = w[ 6];
u32x w7_t = w[ 7];
u32x w8_t = w[ 8];
u32x w9_t = w[ 9];
u32x wa_t = w[10];
u32x wb_t = w[11];
u32x wc_t = w[12];
u32x wd_t = w[13];
u32x we_t = w[14];
u32x wf_t = w[15];
#define ROUND_EXPAND() \ #define ROUND_EXPAND() \
{ \ { \
@ -128,16 +133,16 @@ static void sha256_transform (u32 digest[8], const u32 w[16])
digest[7] += h; digest[7] += h;
} }
static void sha256_transform_z (u32 digest[8]) static void sha256_transform_z (u32x digest[8])
{ {
u32 a = digest[0]; u32x a = digest[0];
u32 b = digest[1]; u32x b = digest[1];
u32 c = digest[2]; u32x c = digest[2];
u32 d = digest[3]; u32x d = digest[3];
u32 e = digest[4]; u32x e = digest[4];
u32 f = digest[5]; u32x f = digest[5];
u32 g = digest[6]; u32x g = digest[6];
u32 h = digest[7]; u32x h = digest[7];
#define ROUND_STEP_Z(i) \ #define ROUND_STEP_Z(i) \
{ \ { \
@ -177,16 +182,16 @@ static void sha256_transform_z (u32 digest[8])
digest[7] += h; digest[7] += h;
} }
static void sha256_transform_s (u32 digest[8], __local u32 *w) static void sha256_transform_s (u32x digest[8], __local u32 *w)
{ {
u32 a = digest[0]; u32x a = digest[0];
u32 b = digest[1]; u32x b = digest[1];
u32 c = digest[2]; u32x c = digest[2];
u32 d = digest[3]; u32x d = digest[3];
u32 e = digest[4]; u32x e = digest[4];
u32 f = digest[5]; u32x f = digest[5];
u32 g = digest[6]; u32x g = digest[6];
u32 h = digest[7]; u32x h = digest[7];
#define ROUND_STEP_S(i) \ #define ROUND_STEP_S(i) \
{ \ { \
@ -240,9 +245,9 @@ __kernel void m08000_m04 (__global pw_t *pws, __global kernel_rule_t *rules_buf,
* salt * salt
*/ */
const u32 salt_buf0 = swap32 (salt_bufs[salt_pos].salt_buf[ 0]); const u32 salt_buf0 = swap32_S (salt_bufs[salt_pos].salt_buf[ 0]);
const u32 salt_buf1 = swap32 (salt_bufs[salt_pos].salt_buf[ 1]); const u32 salt_buf1 = swap32_S (salt_bufs[salt_pos].salt_buf[ 1]);
const u32 salt_buf2 = swap32 (salt_bufs[salt_pos].salt_buf[ 2]); // 0x80 const u32 salt_buf2 = swap32_S (salt_bufs[salt_pos].salt_buf[ 2]); // 0x80
/** /**
* precompute final msg blocks * precompute final msg blocks
@ -266,7 +271,7 @@ __kernel void m08000_m04 (__global pw_t *pws, __global kernel_rule_t *rules_buf,
#pragma unroll #pragma unroll
for (int i = 16; i < 64; i++) for (int i = 16; i < 64; i++)
{ {
w_s1[i] = SHA256_EXPAND (w_s1[i - 2], w_s1[i - 7], w_s1[i - 15], w_s1[i - 16]); w_s1[i] = SHA256_EXPAND_S (w_s1[i - 2], w_s1[i - 7], w_s1[i - 15], w_s1[i - 16]);
} }
w_s2[ 0] = salt_buf0 << 16 | salt_buf1 >> 16; w_s2[ 0] = salt_buf0 << 16 | salt_buf1 >> 16;
@ -277,7 +282,7 @@ __kernel void m08000_m04 (__global pw_t *pws, __global kernel_rule_t *rules_buf,
#pragma unroll #pragma unroll
for (int i = 16; i < 64; i++) for (int i = 16; i < 64; i++)
{ {
w_s2[i] = SHA256_EXPAND (w_s2[i - 2], w_s2[i - 7], w_s2[i - 15], w_s2[i - 16]); w_s2[i] = SHA256_EXPAND_S (w_s2[i - 2], w_s2[i - 7], w_s2[i - 15], w_s2[i - 16]);
} }
} }
@ -289,78 +294,73 @@ __kernel void m08000_m04 (__global pw_t *pws, __global kernel_rule_t *rules_buf,
* base * base
*/ */
u32 wordl0[4]; u32 pw_buf0[4];
u32 pw_buf1[4];
wordl0[0] = pws[gid].i[ 0]; pw_buf0[0] = pws[gid].i[0];
wordl0[1] = pws[gid].i[ 1]; pw_buf0[1] = pws[gid].i[1];
wordl0[2] = pws[gid].i[ 2]; pw_buf0[2] = pws[gid].i[2];
wordl0[3] = pws[gid].i[ 3]; pw_buf0[3] = pws[gid].i[3];
pw_buf1[0] = pws[gid].i[4];
u32 wordl1[4]; pw_buf1[1] = pws[gid].i[5];
pw_buf1[2] = pws[gid].i[6];
wordl1[0] = pws[gid].i[ 4]; pw_buf1[3] = pws[gid].i[7];
wordl1[1] = pws[gid].i[ 5];
wordl1[2] = pws[gid].i[ 6];
wordl1[3] = pws[gid].i[ 7];
u32 wordl2[4];
wordl2[0] = 0;
wordl2[1] = 0;
wordl2[2] = 0;
wordl2[3] = 0;
u32 wordl3[4];
wordl3[0] = 0;
wordl3[1] = 0;
wordl3[2] = 0;
wordl3[3] = 0;
const u32 pw_l_len = pws[gid].pw_len; const u32 pw_l_len = pws[gid].pw_len;
if (combs_mode == COMBINATOR_MODE_BASE_RIGHT)
{
switch_buffer_by_offset_le (wordl0, wordl1, wordl2, wordl3, combs_buf[0].pw_len);
}
/** /**
* loop * loop
*/ */
for (u32 il_pos = 0; il_pos < il_cnt; il_pos++) for (u32 il_pos = 0; il_pos < il_cnt; il_pos += VECT_SIZE)
{ {
u32 wordr0[4]; const u32x pw_r_len = pwlenx_create_combt (combs_buf, il_pos);
u32 wordr1[4];
u32 wordr2[4];
u32 wordr3[4];
wordr0[0] = combs_buf[il_pos].i[0]; const u32x pw_len = pw_l_len + pw_r_len;
wordr0[1] = combs_buf[il_pos].i[1];
wordr0[2] = combs_buf[il_pos].i[2]; /**
wordr0[3] = combs_buf[il_pos].i[3]; * concat password candidate
wordr1[0] = combs_buf[il_pos].i[4]; */
wordr1[1] = combs_buf[il_pos].i[5];
wordr1[2] = combs_buf[il_pos].i[6]; u32x wordl0[4] = { 0 };
wordr1[3] = combs_buf[il_pos].i[7]; u32x wordl1[4] = { 0 };
wordr2[0] = 0; u32x wordl2[4] = { 0 };
wordr2[1] = 0; u32x wordl3[4] = { 0 };
wordr2[2] = 0;
wordr2[3] = 0; wordl0[0] = pw_buf0[0];
wordr3[0] = 0; wordl0[1] = pw_buf0[1];
wordr3[1] = 0; wordl0[2] = pw_buf0[2];
wordr3[2] = 0; wordl0[3] = pw_buf0[3];
wordr3[3] = 0; wordl1[0] = pw_buf1[0];
wordl1[1] = pw_buf1[1];
wordl1[2] = pw_buf1[2];
wordl1[3] = pw_buf1[3];
u32x wordr0[4] = { 0 };
u32x wordr1[4] = { 0 };
u32x wordr2[4] = { 0 };
u32x wordr3[4] = { 0 };
wordr0[0] = ix_create_combt (combs_buf, il_pos, 0);
wordr0[1] = ix_create_combt (combs_buf, il_pos, 1);
wordr0[2] = ix_create_combt (combs_buf, il_pos, 2);
wordr0[3] = ix_create_combt (combs_buf, il_pos, 3);
wordr1[0] = ix_create_combt (combs_buf, il_pos, 4);
wordr1[1] = ix_create_combt (combs_buf, il_pos, 5);
wordr1[2] = ix_create_combt (combs_buf, il_pos, 6);
wordr1[3] = ix_create_combt (combs_buf, il_pos, 7);
if (combs_mode == COMBINATOR_MODE_BASE_LEFT) if (combs_mode == COMBINATOR_MODE_BASE_LEFT)
{ {
switch_buffer_by_offset_le (wordr0, wordr1, wordr2, wordr3, pw_l_len); switch_buffer_by_offset_le_VV (wordr0, wordr1, wordr2, wordr3, pw_l_len);
}
else
{
switch_buffer_by_offset_le_VV (wordl0, wordl1, wordl2, wordl3, pw_r_len);
} }
u32 w0[4]; u32x w0[4];
u32 w1[4]; u32x w1[4];
u32 w2[4];
u32 w3[4];
w0[0] = wordl0[0] | wordr0[0]; w0[0] = wordl0[0] | wordr0[0];
w0[1] = wordl0[1] | wordr0[1]; w0[1] = wordl0[1] | wordr0[1];
@ -370,25 +370,20 @@ __kernel void m08000_m04 (__global pw_t *pws, __global kernel_rule_t *rules_buf,
w1[1] = wordl1[1] | wordr1[1]; w1[1] = wordl1[1] | wordr1[1];
w1[2] = wordl1[2] | wordr1[2]; w1[2] = wordl1[2] | wordr1[2];
w1[3] = wordl1[3] | wordr1[3]; w1[3] = wordl1[3] | wordr1[3];
w2[0] = wordl2[0] | wordr2[0];
w2[1] = wordl2[1] | wordr2[1];
w2[2] = wordl2[2] | wordr2[2];
w2[3] = wordl2[3] | wordr2[3];
w3[0] = wordl3[0] | wordr3[0];
w3[1] = wordl3[1] | wordr3[1];
w3[2] = wordl3[2] | wordr3[2];
w3[3] = wordl3[3] | wordr3[3];
u32 w0_t[4]; /**
u32 w1_t[4]; * SHA256
u32 w2_t[4]; */
u32 w3_t[4];
u32x w0_t[4];
u32x w1_t[4];
u32x w2_t[4];
u32x w3_t[4];
make_unicode (w0, w0_t, w1_t); make_unicode (w0, w0_t, w1_t);
make_unicode (w1, w2_t, w3_t); make_unicode (w1, w2_t, w3_t);
u32 w_t[16]; u32x w_t[16];
w_t[ 0] = swap32 (w0_t[0]); w_t[ 0] = swap32 (w0_t[0]);
w_t[ 1] = swap32 (w0_t[1]); w_t[ 1] = swap32 (w0_t[1]);
@ -424,7 +419,7 @@ __kernel void m08000_m04 (__global pw_t *pws, __global kernel_rule_t *rules_buf,
w_t[14] = w_t[14] >> 8; w_t[14] = w_t[14] >> 8;
w_t[15] = w_t[15] >> 8; w_t[15] = w_t[15] >> 8;
u32 digest[8]; u32x digest[8];
digest[0] = SHA256M_A; digest[0] = SHA256M_A;
digest[1] = SHA256M_B; digest[1] = SHA256M_B;
@ -445,12 +440,7 @@ __kernel void m08000_m04 (__global pw_t *pws, __global kernel_rule_t *rules_buf,
sha256_transform_s (digest, w_s1); // 448 - 512 sha256_transform_s (digest, w_s1); // 448 - 512
sha256_transform_s (digest, w_s2); // 512 - 576 sha256_transform_s (digest, w_s2); // 512 - 576
const u32 r0 = digest[3]; COMPARE_M_SIMD (digest[3], digest[7], digest[2], digest[6]);
const u32 r1 = digest[7];
const u32 r2 = digest[2];
const u32 r3 = digest[6];
#include COMPARE_M
} }
} }
@ -476,9 +466,9 @@ __kernel void m08000_s04 (__global pw_t *pws, __global kernel_rule_t *rules_buf,
* salt * salt
*/ */
const u32 salt_buf0 = swap32 (salt_bufs[salt_pos].salt_buf[ 0]); const u32 salt_buf0 = swap32_S (salt_bufs[salt_pos].salt_buf[ 0]);
const u32 salt_buf1 = swap32 (salt_bufs[salt_pos].salt_buf[ 1]); const u32 salt_buf1 = swap32_S (salt_bufs[salt_pos].salt_buf[ 1]);
const u32 salt_buf2 = swap32 (salt_bufs[salt_pos].salt_buf[ 2]); // 0x80 const u32 salt_buf2 = swap32_S (salt_bufs[salt_pos].salt_buf[ 2]); // 0x80
/** /**
* precompute final msg blocks * precompute final msg blocks
@ -502,7 +492,7 @@ __kernel void m08000_s04 (__global pw_t *pws, __global kernel_rule_t *rules_buf,
#pragma unroll #pragma unroll
for (int i = 16; i < 64; i++) for (int i = 16; i < 64; i++)
{ {
w_s1[i] = SHA256_EXPAND (w_s1[i - 2], w_s1[i - 7], w_s1[i - 15], w_s1[i - 16]); w_s1[i] = SHA256_EXPAND_S (w_s1[i - 2], w_s1[i - 7], w_s1[i - 15], w_s1[i - 16]);
} }
w_s2[ 0] = salt_buf0 << 16 | salt_buf1 >> 16; w_s2[ 0] = salt_buf0 << 16 | salt_buf1 >> 16;
@ -513,7 +503,7 @@ __kernel void m08000_s04 (__global pw_t *pws, __global kernel_rule_t *rules_buf,
#pragma unroll #pragma unroll
for (int i = 16; i < 64; i++) for (int i = 16; i < 64; i++)
{ {
w_s2[i] = SHA256_EXPAND (w_s2[i - 2], w_s2[i - 7], w_s2[i - 15], w_s2[i - 16]); w_s2[i] = SHA256_EXPAND_S (w_s2[i - 2], w_s2[i - 7], w_s2[i - 15], w_s2[i - 16]);
} }
} }
@ -525,41 +515,20 @@ __kernel void m08000_s04 (__global pw_t *pws, __global kernel_rule_t *rules_buf,
* base * base
*/ */
u32 wordl0[4]; u32 pw_buf0[4];
u32 pw_buf1[4];
wordl0[0] = pws[gid].i[ 0]; pw_buf0[0] = pws[gid].i[0];
wordl0[1] = pws[gid].i[ 1]; pw_buf0[1] = pws[gid].i[1];
wordl0[2] = pws[gid].i[ 2]; pw_buf0[2] = pws[gid].i[2];
wordl0[3] = pws[gid].i[ 3]; pw_buf0[3] = pws[gid].i[3];
pw_buf1[0] = pws[gid].i[4];
u32 wordl1[4]; pw_buf1[1] = pws[gid].i[5];
pw_buf1[2] = pws[gid].i[6];
wordl1[0] = pws[gid].i[ 4]; pw_buf1[3] = pws[gid].i[7];
wordl1[1] = pws[gid].i[ 5];
wordl1[2] = pws[gid].i[ 6];
wordl1[3] = pws[gid].i[ 7];
u32 wordl2[4];
wordl2[0] = 0;
wordl2[1] = 0;
wordl2[2] = 0;
wordl2[3] = 0;
u32 wordl3[4];
wordl3[0] = 0;
wordl3[1] = 0;
wordl3[2] = 0;
wordl3[3] = 0;
const u32 pw_l_len = pws[gid].pw_len; const u32 pw_l_len = pws[gid].pw_len;
if (combs_mode == COMBINATOR_MODE_BASE_RIGHT)
{
switch_buffer_by_offset_le (wordl0, wordl1, wordl2, wordl3, combs_buf[0].pw_len);
}
/** /**
* digest * digest
*/ */
@ -576,39 +545,55 @@ __kernel void m08000_s04 (__global pw_t *pws, __global kernel_rule_t *rules_buf,
* loop * loop
*/ */
for (u32 il_pos = 0; il_pos < il_cnt; il_pos++) for (u32 il_pos = 0; il_pos < il_cnt; il_pos += VECT_SIZE)
{ {
u32 wordr0[4]; const u32x pw_r_len = pwlenx_create_combt (combs_buf, il_pos);
u32 wordr1[4];
u32 wordr2[4];
u32 wordr3[4];
wordr0[0] = combs_buf[il_pos].i[0]; const u32x pw_len = pw_l_len + pw_r_len;
wordr0[1] = combs_buf[il_pos].i[1];
wordr0[2] = combs_buf[il_pos].i[2]; /**
wordr0[3] = combs_buf[il_pos].i[3]; * concat password candidate
wordr1[0] = combs_buf[il_pos].i[4]; */
wordr1[1] = combs_buf[il_pos].i[5];
wordr1[2] = combs_buf[il_pos].i[6]; u32x wordl0[4] = { 0 };
wordr1[3] = combs_buf[il_pos].i[7]; u32x wordl1[4] = { 0 };
wordr2[0] = 0; u32x wordl2[4] = { 0 };
wordr2[1] = 0; u32x wordl3[4] = { 0 };
wordr2[2] = 0;
wordr2[3] = 0; wordl0[0] = pw_buf0[0];
wordr3[0] = 0; wordl0[1] = pw_buf0[1];
wordr3[1] = 0; wordl0[2] = pw_buf0[2];
wordr3[2] = 0; wordl0[3] = pw_buf0[3];
wordr3[3] = 0; wordl1[0] = pw_buf1[0];
wordl1[1] = pw_buf1[1];
wordl1[2] = pw_buf1[2];
wordl1[3] = pw_buf1[3];
u32x wordr0[4] = { 0 };
u32x wordr1[4] = { 0 };
u32x wordr2[4] = { 0 };
u32x wordr3[4] = { 0 };
wordr0[0] = ix_create_combt (combs_buf, il_pos, 0);
wordr0[1] = ix_create_combt (combs_buf, il_pos, 1);
wordr0[2] = ix_create_combt (combs_buf, il_pos, 2);
wordr0[3] = ix_create_combt (combs_buf, il_pos, 3);
wordr1[0] = ix_create_combt (combs_buf, il_pos, 4);
wordr1[1] = ix_create_combt (combs_buf, il_pos, 5);
wordr1[2] = ix_create_combt (combs_buf, il_pos, 6);
wordr1[3] = ix_create_combt (combs_buf, il_pos, 7);
if (combs_mode == COMBINATOR_MODE_BASE_LEFT) if (combs_mode == COMBINATOR_MODE_BASE_LEFT)
{ {
switch_buffer_by_offset_le (wordr0, wordr1, wordr2, wordr3, pw_l_len); switch_buffer_by_offset_le_VV (wordr0, wordr1, wordr2, wordr3, pw_l_len);
}
else
{
switch_buffer_by_offset_le_VV (wordl0, wordl1, wordl2, wordl3, pw_r_len);
} }
u32 w0[4]; u32x w0[4];
u32 w1[4]; u32x w1[4];
u32 w2[4];
u32 w3[4];
w0[0] = wordl0[0] | wordr0[0]; w0[0] = wordl0[0] | wordr0[0];
w0[1] = wordl0[1] | wordr0[1]; w0[1] = wordl0[1] | wordr0[1];
@ -618,25 +603,20 @@ __kernel void m08000_s04 (__global pw_t *pws, __global kernel_rule_t *rules_buf,
w1[1] = wordl1[1] | wordr1[1]; w1[1] = wordl1[1] | wordr1[1];
w1[2] = wordl1[2] | wordr1[2]; w1[2] = wordl1[2] | wordr1[2];
w1[3] = wordl1[3] | wordr1[3]; w1[3] = wordl1[3] | wordr1[3];
w2[0] = wordl2[0] | wordr2[0];
w2[1] = wordl2[1] | wordr2[1];
w2[2] = wordl2[2] | wordr2[2];
w2[3] = wordl2[3] | wordr2[3];
w3[0] = wordl3[0] | wordr3[0];
w3[1] = wordl3[1] | wordr3[1];
w3[2] = wordl3[2] | wordr3[2];
w3[3] = wordl3[3] | wordr3[3];
u32 w0_t[4]; /**
u32 w1_t[4]; * SHA256
u32 w2_t[4]; */
u32 w3_t[4];
u32x w0_t[4];
u32x w1_t[4];
u32x w2_t[4];
u32x w3_t[4];
make_unicode (w0, w0_t, w1_t); make_unicode (w0, w0_t, w1_t);
make_unicode (w1, w2_t, w3_t); make_unicode (w1, w2_t, w3_t);
u32 w_t[16]; u32x w_t[16];
w_t[ 0] = swap32 (w0_t[0]); w_t[ 0] = swap32 (w0_t[0]);
w_t[ 1] = swap32 (w0_t[1]); w_t[ 1] = swap32 (w0_t[1]);
@ -672,7 +652,7 @@ __kernel void m08000_s04 (__global pw_t *pws, __global kernel_rule_t *rules_buf,
w_t[14] = w_t[14] >> 8; w_t[14] = w_t[14] >> 8;
w_t[15] = w_t[15] >> 8; w_t[15] = w_t[15] >> 8;
u32 digest[8]; u32x digest[8];
digest[0] = SHA256M_A; digest[0] = SHA256M_A;
digest[1] = SHA256M_B; digest[1] = SHA256M_B;
@ -693,12 +673,7 @@ __kernel void m08000_s04 (__global pw_t *pws, __global kernel_rule_t *rules_buf,
sha256_transform_s (digest, w_s1); // 448 - 512 sha256_transform_s (digest, w_s1); // 448 - 512
sha256_transform_s (digest, w_s2); // 512 - 576 sha256_transform_s (digest, w_s2); // 512 - 576
const u32 r0 = digest[3]; COMPARE_S_SIMD (digest[3], digest[7], digest[2], digest[6]);
const u32 r1 = digest[7];
const u32 r2 = digest[2];
const u32 r3 = digest[6];
#include COMPARE_S
} }
} }