1
0
mirror of https://github.com/hashcat/hashcat.git synced 2024-11-26 18:08:20 +00:00

Cleanup -m 101xx kernels to latest standard

This commit is contained in:
Jens Steube 2016-04-18 10:24:44 +02:00
parent 6c528f25d8
commit 4149ecf78f
3 changed files with 256 additions and 229 deletions

View File

@ -56,14 +56,12 @@ __kernel void m10100_m04 (__global pw_t *pws, __global kernel_rule_t * rules_bu
if (gid >= gid_max) return; if (gid >= gid_max) return;
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];
@ -72,7 +70,7 @@ __kernel void m10100_m04 (__global pw_t *pws, __global kernel_rule_t * rules_bu
const u32 pw_len = pws[gid].pw_len; const u32 pw_len = pws[gid].pw_len;
/** /**
* base * salt
*/ */
u64x v0p = SIPHASHM_0; u64x v0p = SIPHASHM_0;
@ -98,6 +96,10 @@ __kernel void m10100_m04 (__global pw_t *pws, __global kernel_rule_t * rules_bu
const u32x out_len = apply_rules_vect (pw_buf0, pw_buf1, pw_len, rules_buf, il_pos, w0, w1); const u32x out_len = apply_rules_vect (pw_buf0, pw_buf1, pw_len, rules_buf, il_pos, w0, w1);
/**
* siphash
*/
switch (out_len / 8) switch (out_len / 8)
{ {
case 0: w0[1] |= out_len << 24; break; case 0: w0[1] |= out_len << 24; break;
@ -181,14 +183,12 @@ __kernel void m10100_s04 (__global pw_t *pws, __global kernel_rule_t * rules_bu
if (gid >= gid_max) return; if (gid >= gid_max) return;
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];
@ -197,7 +197,7 @@ __kernel void m10100_s04 (__global pw_t *pws, __global kernel_rule_t * rules_bu
const u32 pw_len = pws[gid].pw_len; const u32 pw_len = pws[gid].pw_len;
/** /**
* base * salt
*/ */
u64x v0p = SIPHASHM_0; u64x v0p = SIPHASHM_0;
@ -235,6 +235,10 @@ __kernel void m10100_s04 (__global pw_t *pws, __global kernel_rule_t * rules_bu
const u32x out_len = apply_rules_vect (pw_buf0, pw_buf1, pw_len, rules_buf, il_pos, w0, w1); const u32x out_len = apply_rules_vect (pw_buf0, pw_buf1, pw_len, rules_buf, il_pos, w0, w1);
/**
* siphash
*/
switch (out_len / 8) switch (out_len / 8)
{ {
case 0: w0[1] |= out_len << 24; break; case 0: w0[1] |= out_len << 24; break;

View File

@ -5,6 +5,9 @@
#define _SIPHASH_ #define _SIPHASH_
//incompatible to simd
//#define NEW_SIMD_CODE
#include "include/constants.h" #include "include/constants.h"
#include "include/kernel_vendor.h" #include "include/kernel_vendor.h"
@ -16,15 +19,13 @@
#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"
#define SIPROUND(v0,v1,v2,v3) \ #define SIPROUND(v0,v1,v2,v3) \
(v0) += (v1); \ (v0) += (v1); \
(v1) = rotl64 ((v1), 13); \ (v1) = rotl64 ((v1), 13); \
(v1) ^= (v0); \ (v1) ^= (v0); \
(v0) = as_ulong (as_uint2 ((v0)).s10); \ (v0) = rotl64 ((v0), 32); \
(v2) += (v3); \ (v2) += (v3); \
(v3) = rotl64 ((v3), 16); \ (v3) = rotl64 ((v3), 16); \
(v3) ^= (v2); \ (v3) ^= (v2); \
@ -34,7 +35,7 @@
(v2) += (v1); \ (v2) += (v1); \
(v1) = rotl64 ((v1), 17); \ (v1) = rotl64 ((v1), 17); \
(v1) ^= (v2); \ (v1) ^= (v2); \
(v2) = as_ulong (as_uint2 ((v2)).s10); (v2) = rotl64 ((v2), 32)
__kernel void m10100_m04 (__global pw_t *pws, __global kernel_rule_t *rules_buf, __global comb_t *combs_buf, __global bf_t *bfs_buf, __global void *tmps, __global void *hooks, __global u32 *bitmaps_buf_s1_a, __global u32 *bitmaps_buf_s1_b, __global u32 *bitmaps_buf_s1_c, __global u32 *bitmaps_buf_s1_d, __global u32 *bitmaps_buf_s2_a, __global u32 *bitmaps_buf_s2_b, __global u32 *bitmaps_buf_s2_c, __global u32 *bitmaps_buf_s2_d, __global plain_t *plains_buf, __global digest_t *digests_buf, __global u32 *hashes_shown, __global salt_t *salt_bufs, __global void *esalt_bufs, __global u32 *d_return_buf, __global u32 *d_scryptV_buf, const u32 bitmap_mask, const u32 bitmap_shift1, const u32 bitmap_shift2, const u32 salt_pos, const u32 loop_pos, const u32 loop_cnt, const u32 il_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max) __kernel void m10100_m04 (__global pw_t *pws, __global kernel_rule_t *rules_buf, __global comb_t *combs_buf, __global bf_t *bfs_buf, __global void *tmps, __global void *hooks, __global u32 *bitmaps_buf_s1_a, __global u32 *bitmaps_buf_s1_b, __global u32 *bitmaps_buf_s1_c, __global u32 *bitmaps_buf_s1_d, __global u32 *bitmaps_buf_s2_a, __global u32 *bitmaps_buf_s2_b, __global u32 *bitmaps_buf_s2_c, __global u32 *bitmaps_buf_s2_d, __global plain_t *plains_buf, __global digest_t *digests_buf, __global u32 *hashes_shown, __global salt_t *salt_bufs, __global void *esalt_bufs, __global u32 *d_return_buf, __global u32 *d_scryptV_buf, const u32 bitmap_mask, const u32 bitmap_shift1, const u32 bitmap_shift2, const u32 salt_pos, const u32 loop_pos, const u32 loop_cnt, const u32 il_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
{ {
@ -52,49 +53,28 @@ __kernel void m10100_m04 (__global pw_t *pws, __global kernel_rule_t *rules_buf,
if (gid >= gid_max) return; if (gid >= gid_max) return;
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);
}
/** /**
* base * salt
*/ */
u64 v0p = SIPHASHM_0; u64x v0p = SIPHASHM_0;
u64 v1p = SIPHASHM_1; u64x v1p = SIPHASHM_1;
u64 v2p = SIPHASHM_2; u64x v2p = SIPHASHM_2;
u64 v3p = SIPHASHM_3; u64x v3p = SIPHASHM_3;
v0p ^= hl32_to_64 (salt_bufs[salt_pos].salt_buf[1], salt_bufs[salt_pos].salt_buf[0]); v0p ^= hl32_to_64 (salt_bufs[salt_pos].salt_buf[1], salt_bufs[salt_pos].salt_buf[0]);
v1p ^= hl32_to_64 (salt_bufs[salt_pos].salt_buf[3], salt_bufs[salt_pos].salt_buf[2]); v1p ^= hl32_to_64 (salt_bufs[salt_pos].salt_buf[3], salt_bufs[salt_pos].salt_buf[2]);
@ -105,79 +85,110 @@ __kernel void m10100_m04 (__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)
{ {
const u32 pw_r_len = combs_buf[il_pos].pw_len; const u32x pw_r_len = pwlenx_create_combt (combs_buf, il_pos);
const u32 pw_len = pw_l_len + pw_r_len; const u32x pw_len = pw_l_len + pw_r_len;
u32 wordr0[4]; /**
* concat password candidate
*/
wordr0[0] = combs_buf[il_pos].i[0]; u32x wordl0[4] = { 0 };
wordr0[1] = combs_buf[il_pos].i[1]; u32x wordl1[4] = { 0 };
wordr0[2] = combs_buf[il_pos].i[2]; u32x wordl2[4] = { 0 };
wordr0[3] = combs_buf[il_pos].i[3]; u32x wordl3[4] = { 0 };
u32 wordr1[4]; wordl0[0] = pw_buf0[0];
wordl0[1] = pw_buf0[1];
wordl0[2] = pw_buf0[2];
wordl0[3] = pw_buf0[3];
wordl1[0] = pw_buf1[0];
wordl1[1] = pw_buf1[1];
wordl1[2] = pw_buf1[2];
wordl1[3] = pw_buf1[3];
wordr1[0] = combs_buf[il_pos].i[4]; u32x wordr0[4] = { 0 };
wordr1[1] = combs_buf[il_pos].i[5]; u32x wordr1[4] = { 0 };
wordr1[2] = combs_buf[il_pos].i[6]; u32x wordr2[4] = { 0 };
wordr1[3] = combs_buf[il_pos].i[7]; u32x wordr3[4] = { 0 };
u32 wordr2[4]; wordr0[0] = ix_create_combt (combs_buf, il_pos, 0);
wordr0[1] = ix_create_combt (combs_buf, il_pos, 1);
wordr2[0] = 0; wordr0[2] = ix_create_combt (combs_buf, il_pos, 2);
wordr2[1] = 0; wordr0[3] = ix_create_combt (combs_buf, il_pos, 3);
wordr2[2] = 0; wordr1[0] = ix_create_combt (combs_buf, il_pos, 4);
wordr2[3] = 0; wordr1[1] = ix_create_combt (combs_buf, il_pos, 5);
wordr1[2] = ix_create_combt (combs_buf, il_pos, 6);
u32 wordr3[4]; wordr1[3] = ix_create_combt (combs_buf, il_pos, 7);
wordr3[0] = 0;
wordr3[1] = 0;
wordr3[2] = 0;
wordr3[3] = 0;
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 w[16]; u32x w0[4];
u32x w1[4];
u32x w2[4];
u32x w3[4];
w[ 0] = wordl0[0] | wordr0[0]; w0[0] = wordl0[0] | wordr0[0];
w[ 1] = wordl0[1] | wordr0[1]; w0[1] = wordl0[1] | wordr0[1];
w[ 2] = wordl0[2] | wordr0[2]; w0[2] = wordl0[2] | wordr0[2];
w[ 3] = wordl0[3] | wordr0[3]; w0[3] = wordl0[3] | wordr0[3];
w[ 4] = wordl1[0] | wordr1[0]; w1[0] = wordl1[0] | wordr1[0];
w[ 5] = wordl1[1] | wordr1[1]; w1[1] = wordl1[1] | wordr1[1];
w[ 6] = wordl1[2] | wordr1[2]; w1[2] = wordl1[2] | wordr1[2];
w[ 7] = wordl1[3] | wordr1[3]; w1[3] = wordl1[3] | wordr1[3];
w[ 8] = wordl2[0] | wordr2[0]; w2[0] = wordl2[0] | wordr2[0];
w[ 9] = wordl2[1] | wordr2[1]; w2[1] = wordl2[1] | wordr2[1];
w[10] = wordl2[2] | wordr2[2]; w2[2] = wordl2[2] | wordr2[2];
w[11] = wordl2[3] | wordr2[3]; w2[3] = wordl2[3] | wordr2[3];
w[12] = wordl3[0] | wordr3[0]; w3[0] = wordl3[0] | wordr3[0];
w[13] = wordl3[1] | wordr3[1]; w3[1] = wordl3[1] | wordr3[1];
w[14] = wordl3[2] | wordr3[2]; w3[2] = wordl3[2] | wordr3[2];
w[15] = wordl3[3] | wordr3[3]; w3[3] = wordl3[3] | wordr3[3];
u64 *w_ptr = (u64 *) w; /**
* siphash
*/
w_ptr[pw_len / 8] |= (u64) pw_len << 56; switch (pw_len / 8)
{
case 0: w0[1] |= pw_len << 24; break;
case 1: w0[3] |= pw_len << 24; break;
case 2: w1[1] |= pw_len << 24; break;
case 3: w1[3] |= pw_len << 24; break;
}
u64 v0 = v0p; u64x v0 = v0p;
u64 v1 = v1p; u64x v1 = v1p;
u64 v2 = v2p; u64x v2 = v2p;
u64 v3 = v3p; u64x v3 = v3p;
int i; int i;
int j; int j;
for (i = 0, j = 0; i <= pw_len; i += 8, j += 2) for (i = 0, j = 0; i <= pw_len && i < 16; i += 8, j += 2)
{ {
u64 m = hl32_to_64 (w[j + 1], w[j + 0]); u64x m = hl32_to_64 (w0[j + 1], w0[j + 0]);
v3 ^= m;
SIPROUND (v0, v1, v2, v3);
SIPROUND (v0, v1, v2, v3);
v0 ^= m;
}
for ( j = 0; i <= pw_len && i < 32; i += 8, j += 2)
{
u64x m = hl32_to_64 (w1[j + 1], w1[j + 0]);
v3 ^= m; v3 ^= m;
@ -194,17 +205,14 @@ __kernel void m10100_m04 (__global pw_t *pws, __global kernel_rule_t *rules_buf,
SIPROUND (v0, v1, v2, v3); SIPROUND (v0, v1, v2, v3);
SIPROUND (v0, v1, v2, v3); SIPROUND (v0, v1, v2, v3);
const u64 v = v0 ^ v1 ^ v2 ^ v3; const u64x v = v0 ^ v1 ^ v2 ^ v3;
const u32 a = l32_from_64 (v); const u32x a = l32_from_64 (v);
const u32 b = h32_from_64 (v); const u32x b = h32_from_64 (v);
const u32x c = 0;
const u32x d = 0;
const u32 r0 = a; COMPARE_M_SIMD (a, b, c, d);
const u32 r1 = b;
const u32 r2 = 0;
const u32 r3 = 0;
#include COMPARE_M
} }
} }
@ -232,40 +240,33 @@ __kernel void m10100_s04 (__global pw_t *pws, __global kernel_rule_t *rules_buf,
if (gid >= gid_max) return; if (gid >= gid_max) return;
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) /**
{ * salt
switch_buffer_by_offset_le (wordl0, wordl1, wordl2, wordl3, combs_buf[0].pw_len); */
}
u64x v0p = SIPHASHM_0;
u64x v1p = SIPHASHM_1;
u64x v2p = SIPHASHM_2;
u64x v3p = SIPHASHM_3;
v0p ^= hl32_to_64 (salt_bufs[salt_pos].salt_buf[1], salt_bufs[salt_pos].salt_buf[0]);
v1p ^= hl32_to_64 (salt_bufs[salt_pos].salt_buf[3], salt_bufs[salt_pos].salt_buf[2]);
v2p ^= hl32_to_64 (salt_bufs[salt_pos].salt_buf[1], salt_bufs[salt_pos].salt_buf[0]);
v3p ^= hl32_to_64 (salt_bufs[salt_pos].salt_buf[3], salt_bufs[salt_pos].salt_buf[2]);
/** /**
* digest * digest
@ -279,97 +280,114 @@ __kernel void m10100_s04 (__global pw_t *pws, __global kernel_rule_t *rules_buf,
digests_buf[digests_offset].digest_buf[DGST_R3] digests_buf[digests_offset].digest_buf[DGST_R3]
}; };
/**
* base
*/
u64 v0p = SIPHASHM_0;
u64 v1p = SIPHASHM_1;
u64 v2p = SIPHASHM_2;
u64 v3p = SIPHASHM_3;
v0p ^= hl32_to_64 (salt_bufs[salt_pos].salt_buf[1], salt_bufs[salt_pos].salt_buf[0]);
v1p ^= hl32_to_64 (salt_bufs[salt_pos].salt_buf[3], salt_bufs[salt_pos].salt_buf[2]);
v2p ^= hl32_to_64 (salt_bufs[salt_pos].salt_buf[1], salt_bufs[salt_pos].salt_buf[0]);
v3p ^= hl32_to_64 (salt_bufs[salt_pos].salt_buf[3], salt_bufs[salt_pos].salt_buf[2]);
/** /**
* 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)
{ {
const u32 pw_r_len = combs_buf[il_pos].pw_len; const u32x pw_r_len = pwlenx_create_combt (combs_buf, il_pos);
const u32 pw_len = pw_l_len + pw_r_len; const u32x pw_len = pw_l_len + pw_r_len;
u32 wordr0[4]; /**
* concat password candidate
*/
wordr0[0] = combs_buf[il_pos].i[0]; u32x wordl0[4] = { 0 };
wordr0[1] = combs_buf[il_pos].i[1]; u32x wordl1[4] = { 0 };
wordr0[2] = combs_buf[il_pos].i[2]; u32x wordl2[4] = { 0 };
wordr0[3] = combs_buf[il_pos].i[3]; u32x wordl3[4] = { 0 };
u32 wordr1[4]; wordl0[0] = pw_buf0[0];
wordl0[1] = pw_buf0[1];
wordl0[2] = pw_buf0[2];
wordl0[3] = pw_buf0[3];
wordl1[0] = pw_buf1[0];
wordl1[1] = pw_buf1[1];
wordl1[2] = pw_buf1[2];
wordl1[3] = pw_buf1[3];
wordr1[0] = combs_buf[il_pos].i[4]; u32x wordr0[4] = { 0 };
wordr1[1] = combs_buf[il_pos].i[5]; u32x wordr1[4] = { 0 };
wordr1[2] = combs_buf[il_pos].i[6]; u32x wordr2[4] = { 0 };
wordr1[3] = combs_buf[il_pos].i[7]; u32x wordr3[4] = { 0 };
u32 wordr2[4]; wordr0[0] = ix_create_combt (combs_buf, il_pos, 0);
wordr0[1] = ix_create_combt (combs_buf, il_pos, 1);
wordr2[0] = 0; wordr0[2] = ix_create_combt (combs_buf, il_pos, 2);
wordr2[1] = 0; wordr0[3] = ix_create_combt (combs_buf, il_pos, 3);
wordr2[2] = 0; wordr1[0] = ix_create_combt (combs_buf, il_pos, 4);
wordr2[3] = 0; wordr1[1] = ix_create_combt (combs_buf, il_pos, 5);
wordr1[2] = ix_create_combt (combs_buf, il_pos, 6);
u32 wordr3[4]; wordr1[3] = ix_create_combt (combs_buf, il_pos, 7);
wordr3[0] = 0;
wordr3[1] = 0;
wordr3[2] = 0;
wordr3[3] = 0;
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 w[16]; u32x w0[4];
u32x w1[4];
u32x w2[4];
u32x w3[4];
w[ 0] = wordl0[0] | wordr0[0]; w0[0] = wordl0[0] | wordr0[0];
w[ 1] = wordl0[1] | wordr0[1]; w0[1] = wordl0[1] | wordr0[1];
w[ 2] = wordl0[2] | wordr0[2]; w0[2] = wordl0[2] | wordr0[2];
w[ 3] = wordl0[3] | wordr0[3]; w0[3] = wordl0[3] | wordr0[3];
w[ 4] = wordl1[0] | wordr1[0]; w1[0] = wordl1[0] | wordr1[0];
w[ 5] = wordl1[1] | wordr1[1]; w1[1] = wordl1[1] | wordr1[1];
w[ 6] = wordl1[2] | wordr1[2]; w1[2] = wordl1[2] | wordr1[2];
w[ 7] = wordl1[3] | wordr1[3]; w1[3] = wordl1[3] | wordr1[3];
w[ 8] = wordl2[0] | wordr2[0]; w2[0] = wordl2[0] | wordr2[0];
w[ 9] = wordl2[1] | wordr2[1]; w2[1] = wordl2[1] | wordr2[1];
w[10] = wordl2[2] | wordr2[2]; w2[2] = wordl2[2] | wordr2[2];
w[11] = wordl2[3] | wordr2[3]; w2[3] = wordl2[3] | wordr2[3];
w[12] = wordl3[0] | wordr3[0]; w3[0] = wordl3[0] | wordr3[0];
w[13] = wordl3[1] | wordr3[1]; w3[1] = wordl3[1] | wordr3[1];
w[14] = wordl3[2] | wordr3[2]; w3[2] = wordl3[2] | wordr3[2];
w[15] = wordl3[3] | wordr3[3]; w3[3] = wordl3[3] | wordr3[3];
u64 *w_ptr = (u64 *) w; /**
* siphash
*/
w_ptr[pw_len / 8] |= (u64) pw_len << 56; switch (pw_len / 8)
{
case 0: w0[1] |= pw_len << 24; break;
case 1: w0[3] |= pw_len << 24; break;
case 2: w1[1] |= pw_len << 24; break;
case 3: w1[3] |= pw_len << 24; break;
}
u64 v0 = v0p; u64x v0 = v0p;
u64 v1 = v1p; u64x v1 = v1p;
u64 v2 = v2p; u64x v2 = v2p;
u64 v3 = v3p; u64x v3 = v3p;
int i; int i;
int j; int j;
for (i = 0, j = 0; i <= pw_len; i += 8, j += 2) for (i = 0, j = 0; i <= pw_len && i < 16; i += 8, j += 2)
{ {
u64 m = hl32_to_64 (w[j + 1], w[j + 0]); u64x m = hl32_to_64 (w0[j + 1], w0[j + 0]);
v3 ^= m;
SIPROUND (v0, v1, v2, v3);
SIPROUND (v0, v1, v2, v3);
v0 ^= m;
}
for ( j = 0; i <= pw_len && i < 32; i += 8, j += 2)
{
u64x m = hl32_to_64 (w1[j + 1], w1[j + 0]);
v3 ^= m; v3 ^= m;
@ -386,17 +404,14 @@ __kernel void m10100_s04 (__global pw_t *pws, __global kernel_rule_t *rules_buf,
SIPROUND (v0, v1, v2, v3); SIPROUND (v0, v1, v2, v3);
SIPROUND (v0, v1, v2, v3); SIPROUND (v0, v1, v2, v3);
const u64 v = v0 ^ v1 ^ v2 ^ v3; const u64x v = v0 ^ v1 ^ v2 ^ v3;
const u32 a = l32_from_64 (v); const u32x a = l32_from_64 (v);
const u32 b = h32_from_64 (v); const u32x b = h32_from_64 (v);
const u32x c = 0;
const u32x d = 0;
const u32 r0 = a; COMPARE_S_SIMD (a, b, c, d);
const u32 r1 = b;
const u32 r2 = 0;
const u32 r3 = 0;
#include COMPARE_S
} }
} }

View File

@ -46,7 +46,7 @@ static void m10100m (u32 w[16], const u32 pw_len, __global pw_t *pws, __global k
const u32 lid = get_local_id (0); const u32 lid = get_local_id (0);
/** /**
* base * salt
*/ */
u64 v0p = SIPHASHM_0; u64 v0p = SIPHASHM_0;
@ -75,6 +75,10 @@ static void m10100m (u32 w[16], const u32 pw_len, __global pw_t *pws, __global k
const u32x w0 = w0l | w0r; const u32x w0 = w0l | w0r;
/**
* siphash
*/
u64x v0 = v0p; u64x v0 = v0p;
u64x v1 = v1p; u64x v1 = v1p;
u64x v2 = v2p; u64x v2 = v2p;
@ -132,19 +136,7 @@ static void m10100s (u32 w[16], const u32 pw_len, __global pw_t *pws, __global k
const u32 lid = get_local_id (0); const u32 lid = get_local_id (0);
/** /**
* digest * salt
*/
const u32 search[4] =
{
digests_buf[digests_offset].digest_buf[DGST_R0],
digests_buf[digests_offset].digest_buf[DGST_R1],
digests_buf[digests_offset].digest_buf[DGST_R2],
digests_buf[digests_offset].digest_buf[DGST_R3]
};
/**
* base
*/ */
u64 v0p = SIPHASHM_0; u64 v0p = SIPHASHM_0;
@ -161,6 +153,18 @@ static void m10100s (u32 w[16], const u32 pw_len, __global pw_t *pws, __global k
w_ptr[pw_len / 8] |= (u64) pw_len << 56; w_ptr[pw_len / 8] |= (u64) pw_len << 56;
/**
* digest
*/
const u32 search[4] =
{
digests_buf[digests_offset].digest_buf[DGST_R0],
digests_buf[digests_offset].digest_buf[DGST_R1],
digests_buf[digests_offset].digest_buf[DGST_R2],
digests_buf[digests_offset].digest_buf[DGST_R3]
};
/** /**
* loop * loop
*/ */
@ -173,6 +177,10 @@ static void m10100s (u32 w[16], const u32 pw_len, __global pw_t *pws, __global k
const u32x w0 = w0l | w0r; const u32x w0 = w0l | w0r;
/**
* siphash
*/
u64x v0 = v0p; u64x v0 = v0p;
u64x v1 = v1p; u64x v1 = v1p;
u64x v2 = v2p; u64x v2 = v2p;