1
0
mirror of https://github.com/hashcat/hashcat.git synced 2024-11-23 00:28:11 +00:00

Cleanup -m 200 kernels to latest standard

This commit is contained in:
Jens Steube 2016-03-07 20:19:16 +01:00
parent 64897e78a6
commit 1ebe44e70f
3 changed files with 254 additions and 245 deletions

View File

@ -40,14 +40,12 @@ __kernel void m00200_m04 (__global pw_t *pws, __global kernel_rule_t *rules_buf,
if (gid >= gid_max) return;
u32 pw_buf0[4];
u32 pw_buf1[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];
@ -166,14 +164,12 @@ __kernel void m00200_s04 (__global pw_t *pws, __global kernel_rule_t *rules_buf,
if (gid >= gid_max) return;
u32 pw_buf0[4];
u32 pw_buf1[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];

View File

@ -5,6 +5,9 @@
#define _MYSQL323_
//incompatible
//#define NEW_SIMD_CODE
#include "include/constants.h"
#include "include/kernel_vendor.h"
@ -16,9 +19,7 @@
#include "include/kernel_functions.c"
#include "OpenCL/types_ocl.c"
#include "OpenCL/common.c"
#define COMPARE_S "OpenCL/check_single_comp4.c"
#define COMPARE_M "OpenCL/check_multi_comp4.c"
#include "OpenCL/simd.c"
__kernel void m00200_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)
{
@ -36,107 +37,122 @@ __kernel void m00200_m04 (__global pw_t *pws, __global kernel_rule_t *rules_buf,
if (gid >= gid_max) return;
u32 wordl0[4];
u32 pw_buf0[4];
u32 pw_buf1[4];
wordl0[0] = pws[gid].i[ 0];
wordl0[1] = pws[gid].i[ 1];
wordl0[2] = pws[gid].i[ 2];
wordl0[3] = pws[gid].i[ 3];
u32 wordl1[4];
wordl1[0] = pws[gid].i[ 4];
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;
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_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
*/
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];
wordr0[1] = combs_buf[il_pos].i[1];
wordr0[2] = combs_buf[il_pos].i[2];
wordr0[3] = combs_buf[il_pos].i[3];
u32x wordl0[4] = { 0 };
u32x wordl1[4] = { 0 };
u32x wordl2[4] = { 0 };
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];
wordr1[1] = combs_buf[il_pos].i[5];
wordr1[2] = combs_buf[il_pos].i[6];
wordr1[3] = combs_buf[il_pos].i[7];
u32x wordr0[4] = { 0 };
u32x wordr1[4] = { 0 };
u32x wordr2[4] = { 0 };
u32x wordr3[4] = { 0 };
u32 wordr2[4];
wordr2[0] = 0;
wordr2[1] = 0;
wordr2[2] = 0;
wordr2[3] = 0;
u32 wordr3[4];
wordr3[0] = 0;
wordr3[1] = 0;
wordr3[2] = 0;
wordr3[3] = 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)
{
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_t[16];
u32x w0[4];
u32x w1[4];
u32x w2[4];
u32x w3[4];
w_t[ 0] = wordl0[0] | wordr0[0];
w_t[ 1] = wordl0[1] | wordr0[1];
w_t[ 2] = wordl0[2] | wordr0[2];
w_t[ 3] = wordl0[3] | wordr0[3];
w_t[ 4] = wordl1[0] | wordr1[0];
w_t[ 5] = wordl1[1] | wordr1[1];
w_t[ 6] = wordl1[2] | wordr1[2];
w_t[ 7] = wordl1[3] | wordr1[3];
w_t[ 8] = wordl2[0] | wordr2[0];
w_t[ 9] = wordl2[1] | wordr2[1];
w_t[10] = wordl2[2] | wordr2[2];
w_t[11] = wordl2[3] | wordr2[3];
w_t[12] = wordl3[0] | wordr3[0];
w_t[13] = wordl3[1] | wordr3[1];
w_t[14] = wordl3[2] | wordr3[2];
w0[0] = wordl0[0] | wordr0[0];
w0[1] = wordl0[1] | wordr0[1];
w0[2] = wordl0[2] | wordr0[2];
w0[3] = wordl0[3] | wordr0[3];
w1[0] = wordl1[0] | wordr1[0];
w1[1] = wordl1[1] | wordr1[1];
w1[2] = wordl1[2] | wordr1[2];
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] = pw_len * 8;
w3[3] = 0;
/**
* mysql
*/
u32x w_t[16];
w_t[ 0] = w0[0];
w_t[ 1] = w0[1];
w_t[ 2] = w0[2];
w_t[ 3] = w0[3];
w_t[ 4] = w1[0];
w_t[ 5] = w1[1];
w_t[ 6] = w1[2];
w_t[ 7] = w1[3];
w_t[ 8] = 0;
w_t[ 9] = 0;
w_t[10] = 0;
w_t[11] = 0;
w_t[12] = 0;
w_t[13] = 0;
w_t[14] = 0;
w_t[15] = 0;
u32 a = MYSQL323_A;
u32 b = MYSQL323_B;
u32x a = MYSQL323_A;
u32x b = MYSQL323_B;
u32x c = 0;
u32x d = 0;
u32 add = 7;
u32x add = 7;
#define ROUND(v) \
{ \
@ -150,7 +166,7 @@ __kernel void m00200_m04 (__global pw_t *pws, __global kernel_rule_t *rules_buf,
for (i = 0, j = 0; i <= (int) pw_len - 4; i += 4, j += 1)
{
const u32 wj = w_t[j];
const u32x wj = w_t[j];
ROUND ((wj >> 0) & 0xff);
ROUND ((wj >> 8) & 0xff);
@ -158,7 +174,7 @@ __kernel void m00200_m04 (__global pw_t *pws, __global kernel_rule_t *rules_buf,
ROUND ((wj >> 24) & 0xff);
}
const u32 wj = w_t[j];
const u32x wj = w_t[j];
const u32 left = pw_len - i;
@ -181,12 +197,7 @@ __kernel void m00200_m04 (__global pw_t *pws, __global kernel_rule_t *rules_buf,
a &= 0x7fffffff;
b &= 0x7fffffff;
const u32 r0 = a;
const u32 r1 = b;
const u32 r2 = 0;
const u32 r3 = 0;
#include COMPARE_M
COMPARE_M_SIMD (a, b, c, d);
}
}
@ -214,41 +225,20 @@ __kernel void m00200_s04 (__global pw_t *pws, __global kernel_rule_t *rules_buf,
if (gid >= gid_max) return;
u32 wordl0[4];
u32 pw_buf0[4];
u32 pw_buf1[4];
wordl0[0] = pws[gid].i[ 0];
wordl0[1] = pws[gid].i[ 1];
wordl0[2] = pws[gid].i[ 2];
wordl0[3] = pws[gid].i[ 3];
u32 wordl1[4];
wordl1[0] = pws[gid].i[ 4];
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;
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_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
*/
@ -265,68 +255,104 @@ __kernel void m00200_s04 (__global pw_t *pws, __global kernel_rule_t *rules_buf,
* 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];
wordr0[1] = combs_buf[il_pos].i[1];
wordr0[2] = combs_buf[il_pos].i[2];
wordr0[3] = combs_buf[il_pos].i[3];
u32x wordl0[4] = { 0 };
u32x wordl1[4] = { 0 };
u32x wordl2[4] = { 0 };
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];
wordr1[1] = combs_buf[il_pos].i[5];
wordr1[2] = combs_buf[il_pos].i[6];
wordr1[3] = combs_buf[il_pos].i[7];
u32x wordr0[4] = { 0 };
u32x wordr1[4] = { 0 };
u32x wordr2[4] = { 0 };
u32x wordr3[4] = { 0 };
u32 wordr2[4];
wordr2[0] = 0;
wordr2[1] = 0;
wordr2[2] = 0;
wordr2[3] = 0;
u32 wordr3[4];
wordr3[0] = 0;
wordr3[1] = 0;
wordr3[2] = 0;
wordr3[3] = 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)
{
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_t[16];
u32x w0[4];
u32x w1[4];
u32x w2[4];
u32x w3[4];
w_t[ 0] = wordl0[0] | wordr0[0];
w_t[ 1] = wordl0[1] | wordr0[1];
w_t[ 2] = wordl0[2] | wordr0[2];
w_t[ 3] = wordl0[3] | wordr0[3];
w_t[ 4] = wordl1[0] | wordr1[0];
w_t[ 5] = wordl1[1] | wordr1[1];
w_t[ 6] = wordl1[2] | wordr1[2];
w_t[ 7] = wordl1[3] | wordr1[3];
w_t[ 8] = wordl2[0] | wordr2[0];
w_t[ 9] = wordl2[1] | wordr2[1];
w_t[10] = wordl2[2] | wordr2[2];
w_t[11] = wordl2[3] | wordr2[3];
w_t[12] = wordl3[0] | wordr3[0];
w_t[13] = wordl3[1] | wordr3[1];
w_t[14] = wordl3[2] | wordr3[2];
w0[0] = wordl0[0] | wordr0[0];
w0[1] = wordl0[1] | wordr0[1];
w0[2] = wordl0[2] | wordr0[2];
w0[3] = wordl0[3] | wordr0[3];
w1[0] = wordl1[0] | wordr1[0];
w1[1] = wordl1[1] | wordr1[1];
w1[2] = wordl1[2] | wordr1[2];
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] = pw_len * 8;
w3[3] = 0;
/**
* mysql
*/
u32x w_t[16];
w_t[ 0] = w0[0];
w_t[ 1] = w0[1];
w_t[ 2] = w0[2];
w_t[ 3] = w0[3];
w_t[ 4] = w1[0];
w_t[ 5] = w1[1];
w_t[ 6] = w1[2];
w_t[ 7] = w1[3];
w_t[ 8] = 0;
w_t[ 9] = 0;
w_t[10] = 0;
w_t[11] = 0;
w_t[12] = 0;
w_t[13] = 0;
w_t[14] = 0;
w_t[15] = 0;
u32 a = MYSQL323_A;
u32 b = MYSQL323_B;
u32x a = MYSQL323_A;
u32x b = MYSQL323_B;
u32x c = 0;
u32x d = 0;
u32 add = 7;
u32x add = 7;
#define ROUND(v) \
{ \
@ -340,7 +366,7 @@ __kernel void m00200_s04 (__global pw_t *pws, __global kernel_rule_t *rules_buf,
for (i = 0, j = 0; i <= (int) pw_len - 4; i += 4, j += 1)
{
const u32 wj = w_t[j];
const u32x wj = w_t[j];
ROUND ((wj >> 0) & 0xff);
ROUND ((wj >> 8) & 0xff);
@ -348,7 +374,7 @@ __kernel void m00200_s04 (__global pw_t *pws, __global kernel_rule_t *rules_buf,
ROUND ((wj >> 24) & 0xff);
}
const u32 wj = w_t[j];
const u32x wj = w_t[j];
const u32 left = pw_len - i;
@ -371,12 +397,7 @@ __kernel void m00200_s04 (__global pw_t *pws, __global kernel_rule_t *rules_buf,
a &= 0x7fffffff;
b &= 0x7fffffff;
const u32 r0 = a;
const u32 r1 = b;
const u32 r2 = 0;
const u32 r3 = 0;
#include COMPARE_S
COMPARE_S_SIMD (a, b, c, d);
}
}

View File

@ -41,6 +41,25 @@ static void m00200m (u32 w[16], const u32 pw_len, __global pw_t *pws, __global k
const u32x w0 = w0l | w0r;
u32x w_t[16];
w_t[ 0] = w0;
w_t[ 1] = w[ 1];
w_t[ 2] = w[ 2];
w_t[ 3] = w[ 3];
w_t[ 4] = w[ 4];
w_t[ 5] = w[ 5];
w_t[ 6] = w[ 6];
w_t[ 7] = w[ 7];
w_t[ 8] = w[ 8];
w_t[ 9] = w[ 9];
w_t[10] = w[10];
w_t[11] = w[11];
w_t[12] = w[12];
w_t[13] = w[13];
w_t[14] = w[14];
w_t[15] = w[15];
u32x a = MYSQL323_A;
u32x b = MYSQL323_B;
u32x c = 0;
@ -55,35 +74,12 @@ static void m00200m (u32 w[16], const u32 pw_len, __global pw_t *pws, __global k
add += v; \
}
if (pw_len >= 4)
{
ROUND ((w0 >> 0) & 0xff);
ROUND ((w0 >> 8) & 0xff);
ROUND ((w0 >> 16) & 0xff);
ROUND ((w0 >> 24) & 0xff);
}
else if (pw_len == 3)
{
ROUND ((w0 >> 0) & 0xff);
ROUND ((w0 >> 8) & 0xff);
ROUND ((w0 >> 16) & 0xff);
}
else if (pw_len == 2)
{
ROUND ((w0 >> 0) & 0xff);
ROUND ((w0 >> 8) & 0xff);
}
else if (pw_len == 1)
{
ROUND ((w0 >> 0) & 0xff);
}
int i;
int j;
for (i = 4, j = 1; i <= (int) pw_len - 4; i += 4, j += 1)
for (i = 0, j = 0; i <= (int) pw_len - 4; i += 4, j += 1)
{
const u32x wj = w[j];
const u32x wj = w_t[j];
ROUND ((wj >> 0) & 0xff);
ROUND ((wj >> 8) & 0xff);
@ -91,7 +87,7 @@ static void m00200m (u32 w[16], const u32 pw_len, __global pw_t *pws, __global k
ROUND ((wj >> 24) & 0xff);
}
const u32x wj = w[j];
const u32x wj = w_t[j];
const u32 left = pw_len - i;
@ -151,6 +147,25 @@ static void m00200s (u32 w[16], const u32 pw_len, __global pw_t *pws, __global k
const u32x w0 = w0l | w0r;
u32x w_t[16];
w_t[ 0] = w0;
w_t[ 1] = w[ 1];
w_t[ 2] = w[ 2];
w_t[ 3] = w[ 3];
w_t[ 4] = w[ 4];
w_t[ 5] = w[ 5];
w_t[ 6] = w[ 6];
w_t[ 7] = w[ 7];
w_t[ 8] = w[ 8];
w_t[ 9] = w[ 9];
w_t[10] = w[10];
w_t[11] = w[11];
w_t[12] = w[12];
w_t[13] = w[13];
w_t[14] = w[14];
w_t[15] = w[15];
u32x a = MYSQL323_A;
u32x b = MYSQL323_B;
u32x c = 0;
@ -165,35 +180,12 @@ static void m00200s (u32 w[16], const u32 pw_len, __global pw_t *pws, __global k
add += v; \
}
if (pw_len >= 4)
{
ROUND ((w0 >> 0) & 0xff);
ROUND ((w0 >> 8) & 0xff);
ROUND ((w0 >> 16) & 0xff);
ROUND ((w0 >> 24) & 0xff);
}
else if (pw_len == 3)
{
ROUND ((w0 >> 0) & 0xff);
ROUND ((w0 >> 8) & 0xff);
ROUND ((w0 >> 16) & 0xff);
}
else if (pw_len == 2)
{
ROUND ((w0 >> 0) & 0xff);
ROUND ((w0 >> 8) & 0xff);
}
else if (pw_len == 1)
{
ROUND ((w0 >> 0) & 0xff);
}
int i;
int j;
for (i = 4, j = 1; i <= (int) pw_len - 4; i += 4, j += 1)
for (i = 0, j = 0; i <= (int) pw_len - 4; i += 4, j += 1)
{
const u32x wj = w[j];
const u32x wj = w_t[j];
ROUND ((wj >> 0) & 0xff);
ROUND ((wj >> 8) & 0xff);
@ -201,7 +193,7 @@ static void m00200s (u32 w[16], const u32 pw_len, __global pw_t *pws, __global k
ROUND ((wj >> 24) & 0xff);
}
const u32x wj = w[j];
const u32x wj = w_t[j];
const u32 left = pw_len - i;