|
|
|
@ -14,6 +14,30 @@
|
|
|
|
|
#include "inc_simd.cl"
|
|
|
|
|
#include "inc_hash_md5.cl"
|
|
|
|
|
|
|
|
|
|
DECLSPEC u32 hashCode_g (const u32 init, __global u32 * restrict w, const u32 pw_len)
|
|
|
|
|
{
|
|
|
|
|
u32 hash = init;
|
|
|
|
|
|
|
|
|
|
for (u32 i = 0; i < pw_len; i += 4)
|
|
|
|
|
{
|
|
|
|
|
u32 tmp = w[i / 4];
|
|
|
|
|
|
|
|
|
|
const u32 left = pw_len - i;
|
|
|
|
|
|
|
|
|
|
const u32 c = (left > 4) ? 4 : left;
|
|
|
|
|
|
|
|
|
|
switch (c)
|
|
|
|
|
{
|
|
|
|
|
case 4: hash *= 31; hash += tmp & 0xff; tmp >>= 8;
|
|
|
|
|
case 3: hash *= 31; hash += tmp & 0xff; tmp >>= 8;
|
|
|
|
|
case 2: hash *= 31; hash += tmp & 0xff; tmp >>= 8;
|
|
|
|
|
case 1: hash *= 31; hash += tmp & 0xff;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return hash;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
__kernel void m18700_m04 (KERN_ATTR_BASIC ())
|
|
|
|
|
{
|
|
|
|
|
/**
|
|
|
|
@ -30,19 +54,7 @@ __kernel void m18700_m04 (KERN_ATTR_BASIC ())
|
|
|
|
|
|
|
|
|
|
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];
|
|
|
|
|
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 & 63;
|
|
|
|
|
const u32 base = hashCode_g (0, pws[gid].i, pws[gid].pw_len);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* loop
|
|
|
|
@ -50,85 +62,7 @@ __kernel void m18700_m04 (KERN_ATTR_BASIC ())
|
|
|
|
|
|
|
|
|
|
for (u32 il_pos = 0; il_pos < il_cnt; il_pos += VECT_SIZE)
|
|
|
|
|
{
|
|
|
|
|
const u32x pw_r_len = pwlenx_create_combt (combs_buf, il_pos) & 63;
|
|
|
|
|
|
|
|
|
|
const u32x pw_len = (pw_l_len + pw_r_len) & 63;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* concat password candidate
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
u32x wordl0[4] = { 0 };
|
|
|
|
|
u32x wordl1[4] = { 0 };
|
|
|
|
|
u32x wordl2[4] = { 0 };
|
|
|
|
|
u32x wordl3[4] = { 0 };
|
|
|
|
|
|
|
|
|
|
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];
|
|
|
|
|
|
|
|
|
|
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)
|
|
|
|
|
{
|
|
|
|
|
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);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
u32x w[16];
|
|
|
|
|
|
|
|
|
|
w[ 0] = wordl0[0] | wordr0[0];
|
|
|
|
|
w[ 1] = wordl0[1] | wordr0[1];
|
|
|
|
|
w[ 2] = wordl0[2] | wordr0[2];
|
|
|
|
|
w[ 3] = wordl0[3] | wordr0[3];
|
|
|
|
|
w[ 4] = wordl1[0] | wordr1[0];
|
|
|
|
|
w[ 5] = wordl1[1] | wordr1[1];
|
|
|
|
|
w[ 6] = wordl1[2] | wordr1[2];
|
|
|
|
|
w[ 7] = wordl1[3] | wordr1[3];
|
|
|
|
|
w[ 8] = wordl2[0] | wordr2[0];
|
|
|
|
|
w[ 9] = wordl2[1] | wordr2[1];
|
|
|
|
|
w[10] = wordl2[2] | wordr2[2];
|
|
|
|
|
w[11] = wordl2[3] | wordr2[3];
|
|
|
|
|
w[12] = wordl3[0] | wordr3[0];
|
|
|
|
|
w[13] = wordl3[1] | wordr3[1];
|
|
|
|
|
w[14] = wordl3[2] | wordr3[2];
|
|
|
|
|
w[15] = wordl3[3] | wordr3[3];
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* hashCode()
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
u32x hash = 0;
|
|
|
|
|
|
|
|
|
|
for (u32 i = 0; i < pw_len; i++)
|
|
|
|
|
{
|
|
|
|
|
const u32 c32 = w[i / 4];
|
|
|
|
|
|
|
|
|
|
const u32 c = (c32 >> ((i & 3) * 8)) & 0xff;
|
|
|
|
|
|
|
|
|
|
hash *= 31;
|
|
|
|
|
hash += c;
|
|
|
|
|
}
|
|
|
|
|
const u32 hash = hashCode_g (base, combs_buf[il_pos].i, combs_buf[il_pos].pw_len);
|
|
|
|
|
|
|
|
|
|
const u32x r0 = hash;
|
|
|
|
|
const u32x r1 = 0;
|
|
|
|
@ -163,19 +97,7 @@ __kernel void m18700_s04 (KERN_ATTR_BASIC ())
|
|
|
|
|
|
|
|
|
|
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];
|
|
|
|
|
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 & 63;
|
|
|
|
|
const u32 base = hashCode_g (0, pws[gid].i, pws[gid].pw_len);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* digest
|
|
|
|
@ -195,85 +117,7 @@ __kernel void m18700_s04 (KERN_ATTR_BASIC ())
|
|
|
|
|
|
|
|
|
|
for (u32 il_pos = 0; il_pos < il_cnt; il_pos += VECT_SIZE)
|
|
|
|
|
{
|
|
|
|
|
const u32x pw_r_len = pwlenx_create_combt (combs_buf, il_pos) & 63;
|
|
|
|
|
|
|
|
|
|
const u32x pw_len = (pw_l_len + pw_r_len) & 63;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* concat password candidate
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
u32x wordl0[4] = { 0 };
|
|
|
|
|
u32x wordl1[4] = { 0 };
|
|
|
|
|
u32x wordl2[4] = { 0 };
|
|
|
|
|
u32x wordl3[4] = { 0 };
|
|
|
|
|
|
|
|
|
|
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];
|
|
|
|
|
|
|
|
|
|
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)
|
|
|
|
|
{
|
|
|
|
|
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);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
u32x w[16];
|
|
|
|
|
|
|
|
|
|
w[ 0] = wordl0[0] | wordr0[0];
|
|
|
|
|
w[ 1] = wordl0[1] | wordr0[1];
|
|
|
|
|
w[ 2] = wordl0[2] | wordr0[2];
|
|
|
|
|
w[ 3] = wordl0[3] | wordr0[3];
|
|
|
|
|
w[ 4] = wordl1[0] | wordr1[0];
|
|
|
|
|
w[ 5] = wordl1[1] | wordr1[1];
|
|
|
|
|
w[ 6] = wordl1[2] | wordr1[2];
|
|
|
|
|
w[ 7] = wordl1[3] | wordr1[3];
|
|
|
|
|
w[ 8] = wordl2[0] | wordr2[0];
|
|
|
|
|
w[ 9] = wordl2[1] | wordr2[1];
|
|
|
|
|
w[10] = wordl2[2] | wordr2[2];
|
|
|
|
|
w[11] = wordl2[3] | wordr2[3];
|
|
|
|
|
w[12] = wordl3[0] | wordr3[0];
|
|
|
|
|
w[13] = wordl3[1] | wordr3[1];
|
|
|
|
|
w[14] = wordl3[2] | wordr3[2];
|
|
|
|
|
w[15] = wordl3[3] | wordr3[3];
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* hashCode()
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
u32x hash = 0;
|
|
|
|
|
|
|
|
|
|
for (u32 i = 0; i < pw_len; i++)
|
|
|
|
|
{
|
|
|
|
|
const u32 c32 = w[i / 4];
|
|
|
|
|
|
|
|
|
|
const u32 c = (c32 >> ((i & 3) * 8)) & 0xff;
|
|
|
|
|
|
|
|
|
|
hash *= 31;
|
|
|
|
|
hash += c;
|
|
|
|
|
}
|
|
|
|
|
const u32 hash = hashCode_g (base, combs_buf[il_pos].i, combs_buf[il_pos].pw_len);
|
|
|
|
|
|
|
|
|
|
const u32x r0 = hash;
|
|
|
|
|
const u32x r1 = 0;
|
|
|
|
|