mirror of
https://github.com/hashcat/hashcat.git
synced 2025-07-30 18:39:15 +00:00
Convert to ATTACK_EXEC_OUTSIDE_KERNEL
This commit is contained in:
parent
131790ccc7
commit
4fa0194c91
155
OpenCL/m32900-pure.cl
Normal file
155
OpenCL/m32900-pure.cl
Normal file
@ -0,0 +1,155 @@
|
||||
/**
|
||||
* Author......: See docs/credits.txt
|
||||
* License.....: MIT
|
||||
*/
|
||||
|
||||
//#define NEW_SIMD_CODE
|
||||
|
||||
#ifdef KERNEL_STATIC
|
||||
#include M2S(INCLUDE_PATH/inc_vendor.h)
|
||||
#include M2S(INCLUDE_PATH/inc_types.h)
|
||||
#include M2S(INCLUDE_PATH/inc_platform.cl)
|
||||
#include M2S(INCLUDE_PATH/inc_common.cl)
|
||||
#include M2S(INCLUDE_PATH/inc_hash_sha1.cl)
|
||||
#endif
|
||||
|
||||
#define COMPARE_S M2S(INCLUDE_PATH/inc_comp_single.cl)
|
||||
#define COMPARE_M M2S(INCLUDE_PATH/inc_comp_multi.cl)
|
||||
|
||||
typedef struct pbkdf1_sha1_tmp
|
||||
{
|
||||
u32 digest_buf[5];
|
||||
|
||||
} pbkdf1_sha1_tmp;
|
||||
|
||||
KERNEL_FQ KERNEL_FA void m32900_init (KERN_ATTR_TMPS (pbkdf1_sha1_tmp))
|
||||
{
|
||||
/**
|
||||
* base
|
||||
*/
|
||||
|
||||
const u64 gid = get_global_id (0);
|
||||
|
||||
if (gid >= GID_CNT) return;
|
||||
|
||||
/**
|
||||
* init
|
||||
*/
|
||||
|
||||
const u32 pw_len = pws[gid].pw_len;
|
||||
|
||||
u32 w[64] = { 0 };
|
||||
|
||||
for (u32 i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
|
||||
{
|
||||
w[idx] = pws[gid].i[idx];
|
||||
}
|
||||
|
||||
const u32 salt_len = salt_bufs[SALT_POS_HOST].salt_len;
|
||||
|
||||
u32 s[64] = { 0 };
|
||||
|
||||
for (u32 i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
|
||||
{
|
||||
s[idx] = hc_swap32_S (salt_bufs[SALT_POS_HOST].salt_buf[idx]);
|
||||
}
|
||||
|
||||
sha1_ctx_t sha1_ctx;
|
||||
|
||||
sha1_init (&sha1_ctx);
|
||||
|
||||
sha1_update_swap (&sha1_ctx, w, pw_len);
|
||||
|
||||
sha1_update (&sha1_ctx, s, salt_len);
|
||||
|
||||
sha1_final (&sha1_ctx);
|
||||
|
||||
tmps[gid].digest_buf[0] = sha1_ctx.h[0];
|
||||
tmps[gid].digest_buf[1] = sha1_ctx.h[1];
|
||||
tmps[gid].digest_buf[2] = sha1_ctx.h[2];
|
||||
tmps[gid].digest_buf[3] = sha1_ctx.h[3];
|
||||
tmps[gid].digest_buf[4] = sha1_ctx.h[4];
|
||||
}
|
||||
|
||||
KERNEL_FQ KERNEL_FA void m32900_loop (KERN_ATTR_TMPS (pbkdf1_sha1_tmp))
|
||||
{
|
||||
/**
|
||||
* base
|
||||
*/
|
||||
|
||||
const u64 gid = get_global_id (0);
|
||||
|
||||
if (gid >= GID_CNT) return;
|
||||
|
||||
/**
|
||||
* digest
|
||||
*/
|
||||
|
||||
u32 digest[5];
|
||||
|
||||
digest[0] = tmps[gid].digest_buf[0];
|
||||
digest[1] = tmps[gid].digest_buf[1];
|
||||
digest[2] = tmps[gid].digest_buf[2];
|
||||
digest[3] = tmps[gid].digest_buf[3];
|
||||
digest[4] = tmps[gid].digest_buf[4];
|
||||
|
||||
/**
|
||||
* loop
|
||||
*/
|
||||
|
||||
for (u32 i = 0, j = LOOP_POS; i < LOOP_CNT; i++, j++)
|
||||
{
|
||||
sha1_ctx_t ctx;
|
||||
sha1_init (&ctx);
|
||||
|
||||
ctx.w0[0] = digest[0];
|
||||
ctx.w0[1] = digest[1];
|
||||
ctx.w0[2] = digest[2];
|
||||
ctx.w0[3] = digest[3];
|
||||
ctx.w1[0] = digest[4];
|
||||
|
||||
ctx.len = 20;
|
||||
|
||||
sha1_final (&ctx);
|
||||
|
||||
digest[0] = ctx.h[0];
|
||||
digest[1] = ctx.h[1];
|
||||
digest[2] = ctx.h[2];
|
||||
digest[3] = ctx.h[3];
|
||||
digest[4] = ctx.h[4];
|
||||
}
|
||||
|
||||
tmps[gid].digest_buf[0] = digest[0];
|
||||
tmps[gid].digest_buf[1] = digest[1];
|
||||
tmps[gid].digest_buf[2] = digest[2];
|
||||
tmps[gid].digest_buf[3] = digest[3];
|
||||
tmps[gid].digest_buf[4] = digest[4];
|
||||
}
|
||||
|
||||
KERNEL_FQ KERNEL_FA void m32900_comp (KERN_ATTR_TMPS (pbkdf1_sha1_tmp))
|
||||
{
|
||||
/**
|
||||
* modifier
|
||||
*/
|
||||
|
||||
const u64 gid = get_global_id (0);
|
||||
|
||||
if (gid >= GID_CNT) return;
|
||||
|
||||
const u64 lid = get_local_id (0);
|
||||
|
||||
/**
|
||||
* digest
|
||||
*/
|
||||
|
||||
const u32 r0 = tmps[gid].digest_buf[DGST_R0];
|
||||
const u32 r1 = tmps[gid].digest_buf[DGST_R1];
|
||||
const u32 r2 = tmps[gid].digest_buf[DGST_R2];
|
||||
const u32 r3 = tmps[gid].digest_buf[DGST_R3];
|
||||
|
||||
#define il_pos 0
|
||||
|
||||
#ifdef KERNEL_STATIC
|
||||
#include COMPARE_M
|
||||
#endif
|
||||
}
|
@ -1,203 +0,0 @@
|
||||
/**
|
||||
* Author......: See docs/credits.txt
|
||||
* License.....: MIT
|
||||
*/
|
||||
|
||||
//#define NEW_SIMD_CODE
|
||||
|
||||
#ifdef KERNEL_STATIC
|
||||
#include M2S(INCLUDE_PATH/inc_vendor.h)
|
||||
#include M2S(INCLUDE_PATH/inc_types.h)
|
||||
#include M2S(INCLUDE_PATH/inc_platform.cl)
|
||||
#include M2S(INCLUDE_PATH/inc_common.cl)
|
||||
#include M2S(INCLUDE_PATH/inc_rp.h)
|
||||
#include M2S(INCLUDE_PATH/inc_rp.cl)
|
||||
#include M2S(INCLUDE_PATH/inc_scalar.cl)
|
||||
#include M2S(INCLUDE_PATH/inc_hash_sha1.cl)
|
||||
#endif
|
||||
|
||||
KERNEL_FQ void m32900_mxx (KERN_ATTR_RULES ())
|
||||
{
|
||||
/**
|
||||
* modifier
|
||||
*/
|
||||
|
||||
const u64 lid = get_local_id (0);
|
||||
const u64 gid = get_global_id (0);
|
||||
|
||||
if (gid >= GID_CNT) return;
|
||||
|
||||
/**
|
||||
* base
|
||||
*/
|
||||
|
||||
COPY_PW (pws[gid]);
|
||||
|
||||
const u32 salt_len = salt_bufs[SALT_POS_HOST].salt_len;
|
||||
|
||||
u32 s[64] = { 0 };
|
||||
|
||||
for (u32 i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
|
||||
{
|
||||
s[idx] = hc_swap32_S (salt_bufs[SALT_POS_HOST].salt_buf[idx]);
|
||||
}
|
||||
|
||||
const u32 salt_iter = salt_bufs[SALT_POS_HOST].salt_iter;
|
||||
|
||||
sha1_ctx_t ctx0;
|
||||
sha1_init (&ctx0);
|
||||
|
||||
/**
|
||||
* loop
|
||||
*/
|
||||
|
||||
for (u32 il_pos = 0; il_pos < IL_CNT; il_pos++)
|
||||
{
|
||||
pw_t tmp = PASTE_PW;
|
||||
|
||||
tmp.pw_len = apply_rules (rules_buf[il_pos].cmds, tmp.i, tmp.pw_len);
|
||||
|
||||
sha1_ctx_t ctx1 = ctx0;
|
||||
|
||||
sha1_update_swap (&ctx1, tmp.i, tmp.pw_len);
|
||||
|
||||
sha1_update (&ctx1, s, salt_len);
|
||||
|
||||
sha1_final (&ctx1);
|
||||
|
||||
u32 buf[5];
|
||||
|
||||
buf[0] = ctx1.h[0];
|
||||
buf[1] = ctx1.h[1];
|
||||
buf[2] = ctx1.h[2];
|
||||
buf[3] = ctx1.h[3];
|
||||
buf[4] = ctx1.h[4];
|
||||
|
||||
for (int i = 0; i < salt_iter; i++)
|
||||
{
|
||||
sha1_ctx_t ctx = ctx0;
|
||||
|
||||
ctx.w0[0] = buf[0];
|
||||
ctx.w0[1] = buf[1];
|
||||
ctx.w0[2] = buf[2];
|
||||
ctx.w0[3] = buf[3];
|
||||
ctx.w1[0] = buf[4];
|
||||
|
||||
ctx.len = 20;
|
||||
|
||||
sha1_final (&ctx);
|
||||
|
||||
buf[0] = ctx.h[0];
|
||||
buf[1] = ctx.h[1];
|
||||
buf[2] = ctx.h[2];
|
||||
buf[3] = ctx.h[3];
|
||||
buf[4] = ctx.h[4];
|
||||
}
|
||||
|
||||
const u32 r0 = buf[DGST_R0];
|
||||
const u32 r1 = buf[DGST_R1];
|
||||
const u32 r2 = buf[DGST_R2];
|
||||
const u32 r3 = buf[DGST_R3];
|
||||
|
||||
COMPARE_M_SCALAR (r0, r1, r2, r3);
|
||||
}
|
||||
}
|
||||
|
||||
KERNEL_FQ void m32900_sxx (KERN_ATTR_RULES ())
|
||||
{
|
||||
/**
|
||||
* modifier
|
||||
*/
|
||||
|
||||
const u64 lid = get_local_id (0);
|
||||
const u64 gid = get_global_id (0);
|
||||
|
||||
if (gid >= GID_CNT) return;
|
||||
|
||||
/**
|
||||
* digest
|
||||
*/
|
||||
|
||||
const u32 search[4] =
|
||||
{
|
||||
digests_buf[DIGESTS_OFFSET_HOST].digest_buf[DGST_R0],
|
||||
digests_buf[DIGESTS_OFFSET_HOST].digest_buf[DGST_R1],
|
||||
digests_buf[DIGESTS_OFFSET_HOST].digest_buf[DGST_R2],
|
||||
digests_buf[DIGESTS_OFFSET_HOST].digest_buf[DGST_R3]
|
||||
};
|
||||
|
||||
/**
|
||||
* base
|
||||
*/
|
||||
|
||||
COPY_PW (pws[gid]);
|
||||
|
||||
const u32 salt_len = salt_bufs[SALT_POS_HOST].salt_len;
|
||||
|
||||
u32 s[64] = { 0 };
|
||||
|
||||
for (u32 i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
|
||||
{
|
||||
s[idx] = hc_swap32_S (salt_bufs[SALT_POS_HOST].salt_buf[idx]);
|
||||
}
|
||||
|
||||
const u32 salt_iter = salt_bufs[SALT_POS_HOST].salt_iter;
|
||||
|
||||
sha1_ctx_t ctx0;
|
||||
sha1_init (&ctx0);
|
||||
|
||||
/**
|
||||
* loop
|
||||
*/
|
||||
|
||||
for (u32 il_pos = 0; il_pos < IL_CNT; il_pos++)
|
||||
{
|
||||
pw_t tmp = PASTE_PW;
|
||||
|
||||
tmp.pw_len = apply_rules (rules_buf[il_pos].cmds, tmp.i, tmp.pw_len);
|
||||
|
||||
sha1_ctx_t ctx1 = ctx0;
|
||||
|
||||
sha1_update_swap (&ctx1, tmp.i, tmp.pw_len);
|
||||
|
||||
sha1_update (&ctx1, s, salt_len);
|
||||
|
||||
sha1_final (&ctx1);
|
||||
|
||||
u32 buf[5];
|
||||
|
||||
buf[0] = ctx1.h[0];
|
||||
buf[1] = ctx1.h[1];
|
||||
buf[2] = ctx1.h[2];
|
||||
buf[3] = ctx1.h[3];
|
||||
buf[4] = ctx1.h[4];
|
||||
|
||||
for (int i = 0; i < salt_iter; i++)
|
||||
{
|
||||
sha1_ctx_t ctx = ctx0;
|
||||
|
||||
ctx.w0[0] = buf[0];
|
||||
ctx.w0[1] = buf[1];
|
||||
ctx.w0[2] = buf[2];
|
||||
ctx.w0[3] = buf[3];
|
||||
ctx.w1[0] = buf[4];
|
||||
|
||||
ctx.len = 20;
|
||||
|
||||
sha1_final (&ctx);
|
||||
|
||||
buf[0] = ctx.h[0];
|
||||
buf[1] = ctx.h[1];
|
||||
buf[2] = ctx.h[2];
|
||||
buf[3] = ctx.h[3];
|
||||
buf[4] = ctx.h[4];
|
||||
}
|
||||
|
||||
const u32 r0 = buf[DGST_R0];
|
||||
const u32 r1 = buf[DGST_R1];
|
||||
const u32 r2 = buf[DGST_R2];
|
||||
const u32 r3 = buf[DGST_R3];
|
||||
|
||||
COMPARE_S_SCALAR (r0, r1, r2, r3);
|
||||
}
|
||||
}
|
@ -1,197 +0,0 @@
|
||||
/**
|
||||
* Author......: See docs/credits.txt
|
||||
* License.....: MIT
|
||||
*/
|
||||
|
||||
//#define NEW_SIMD_CODE
|
||||
|
||||
#ifdef KERNEL_STATIC
|
||||
#include M2S(INCLUDE_PATH/inc_vendor.h)
|
||||
#include M2S(INCLUDE_PATH/inc_types.h)
|
||||
#include M2S(INCLUDE_PATH/inc_platform.cl)
|
||||
#include M2S(INCLUDE_PATH/inc_common.cl)
|
||||
#include M2S(INCLUDE_PATH/inc_scalar.cl)
|
||||
#include M2S(INCLUDE_PATH/inc_hash_sha1.cl)
|
||||
#endif
|
||||
|
||||
KERNEL_FQ void m32900_mxx (KERN_ATTR_BASIC ())
|
||||
{
|
||||
/**
|
||||
* modifier
|
||||
*/
|
||||
|
||||
const u64 lid = get_local_id (0);
|
||||
const u64 gid = get_global_id (0);
|
||||
|
||||
if (gid >= GID_CNT) return;
|
||||
|
||||
/**
|
||||
* base
|
||||
*/
|
||||
|
||||
const u32 salt_len = salt_bufs[SALT_POS_HOST].salt_len;
|
||||
|
||||
u32 s[64] = { 0 };
|
||||
|
||||
for (u32 i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
|
||||
{
|
||||
s[idx] = hc_swap32_S (salt_bufs[SALT_POS_HOST].salt_buf[idx]);
|
||||
}
|
||||
|
||||
const u32 salt_iter = salt_bufs[SALT_POS_HOST].salt_iter;
|
||||
|
||||
sha1_ctx_t ctx0;
|
||||
sha1_init (&ctx0);
|
||||
|
||||
sha1_ctx_t ctx1 = ctx0;
|
||||
|
||||
sha1_update_global_swap (&ctx1, pws[gid].i, pws[gid].pw_len);
|
||||
|
||||
/**
|
||||
* loop
|
||||
*/
|
||||
|
||||
for (u32 il_pos = 0; il_pos < IL_CNT; il_pos++)
|
||||
{
|
||||
sha1_ctx_t ctx2 = ctx1;
|
||||
|
||||
sha1_update_global_swap (&ctx2, combs_buf[il_pos].i, combs_buf[il_pos].pw_len);
|
||||
|
||||
sha1_update (&ctx2, s, salt_len);
|
||||
|
||||
sha1_final (&ctx2);
|
||||
|
||||
u32 buf[5];
|
||||
|
||||
buf[0] = ctx2.h[0];
|
||||
buf[1] = ctx2.h[1];
|
||||
buf[2] = ctx2.h[2];
|
||||
buf[3] = ctx2.h[3];
|
||||
buf[4] = ctx2.h[4];
|
||||
|
||||
for (int i = 0; i < salt_iter; i++)
|
||||
{
|
||||
sha1_ctx_t ctx = ctx0;
|
||||
|
||||
ctx.w0[0] = buf[0];
|
||||
ctx.w0[1] = buf[1];
|
||||
ctx.w0[2] = buf[2];
|
||||
ctx.w0[3] = buf[3];
|
||||
ctx.w1[0] = buf[4];
|
||||
|
||||
ctx.len = 20;
|
||||
|
||||
sha1_final (&ctx);
|
||||
|
||||
buf[0] = ctx.h[0];
|
||||
buf[1] = ctx.h[1];
|
||||
buf[2] = ctx.h[2];
|
||||
buf[3] = ctx.h[3];
|
||||
buf[4] = ctx.h[4];
|
||||
}
|
||||
|
||||
const u32 r0 = buf[DGST_R0];
|
||||
const u32 r1 = buf[DGST_R1];
|
||||
const u32 r2 = buf[DGST_R2];
|
||||
const u32 r3 = buf[DGST_R3];
|
||||
|
||||
COMPARE_M_SCALAR (r0, r1, r2, r3);
|
||||
}
|
||||
}
|
||||
|
||||
KERNEL_FQ void m32900_sxx (KERN_ATTR_BASIC ())
|
||||
{
|
||||
/**
|
||||
* modifier
|
||||
*/
|
||||
|
||||
const u64 lid = get_local_id (0);
|
||||
const u64 gid = get_global_id (0);
|
||||
|
||||
if (gid >= GID_CNT) return;
|
||||
|
||||
/**
|
||||
* digest
|
||||
*/
|
||||
|
||||
const u32 search[4] =
|
||||
{
|
||||
digests_buf[DIGESTS_OFFSET_HOST].digest_buf[DGST_R0],
|
||||
digests_buf[DIGESTS_OFFSET_HOST].digest_buf[DGST_R1],
|
||||
digests_buf[DIGESTS_OFFSET_HOST].digest_buf[DGST_R2],
|
||||
digests_buf[DIGESTS_OFFSET_HOST].digest_buf[DGST_R3]
|
||||
};
|
||||
|
||||
/**
|
||||
* base
|
||||
*/
|
||||
|
||||
const u32 salt_len = salt_bufs[SALT_POS_HOST].salt_len;
|
||||
|
||||
u32 s[64] = { 0 };
|
||||
|
||||
for (u32 i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
|
||||
{
|
||||
s[idx] = hc_swap32_S (salt_bufs[SALT_POS_HOST].salt_buf[idx]);
|
||||
}
|
||||
|
||||
const u32 salt_iter = salt_bufs[SALT_POS_HOST].salt_iter;
|
||||
|
||||
sha1_ctx_t ctx0;
|
||||
sha1_init (&ctx0);
|
||||
|
||||
sha1_ctx_t ctx1 = ctx0;
|
||||
|
||||
sha1_update_global_swap (&ctx1, pws[gid].i, pws[gid].pw_len);
|
||||
|
||||
/**
|
||||
* loop
|
||||
*/
|
||||
|
||||
for (u32 il_pos = 0; il_pos < IL_CNT; il_pos++)
|
||||
{
|
||||
sha1_ctx_t ctx2 = ctx1;
|
||||
|
||||
sha1_update_global_swap (&ctx2, combs_buf[il_pos].i, combs_buf[il_pos].pw_len);
|
||||
|
||||
sha1_update (&ctx2, s, salt_len);
|
||||
|
||||
sha1_final (&ctx2);
|
||||
|
||||
u32 buf[5];
|
||||
|
||||
buf[0] = ctx2.h[0];
|
||||
buf[1] = ctx2.h[1];
|
||||
buf[2] = ctx2.h[2];
|
||||
buf[3] = ctx2.h[3];
|
||||
buf[4] = ctx2.h[4];
|
||||
|
||||
for (int i = 0; i < salt_iter; i++)
|
||||
{
|
||||
sha1_ctx_t ctx = ctx0;
|
||||
|
||||
ctx.w0[0] = buf[0];
|
||||
ctx.w0[1] = buf[1];
|
||||
ctx.w0[2] = buf[2];
|
||||
ctx.w0[3] = buf[3];
|
||||
ctx.w1[0] = buf[4];
|
||||
|
||||
ctx.len = 20;
|
||||
|
||||
sha1_final (&ctx);
|
||||
|
||||
buf[0] = ctx.h[0];
|
||||
buf[1] = ctx.h[1];
|
||||
buf[2] = ctx.h[2];
|
||||
buf[3] = ctx.h[3];
|
||||
buf[4] = ctx.h[4];
|
||||
}
|
||||
|
||||
const u32 r0 = buf[DGST_R0];
|
||||
const u32 r1 = buf[DGST_R1];
|
||||
const u32 r2 = buf[DGST_R2];
|
||||
const u32 r3 = buf[DGST_R3];
|
||||
|
||||
COMPARE_S_SCALAR (r0, r1, r2, r3);
|
||||
}
|
||||
}
|
@ -1,223 +0,0 @@
|
||||
/**
|
||||
* Author......: See docs/credits.txt
|
||||
* License.....: MIT
|
||||
*/
|
||||
|
||||
#define NEW_SIMD_CODE
|
||||
|
||||
#ifdef KERNEL_STATIC
|
||||
#include M2S(INCLUDE_PATH/inc_vendor.h)
|
||||
#include M2S(INCLUDE_PATH/inc_types.h)
|
||||
#include M2S(INCLUDE_PATH/inc_platform.cl)
|
||||
#include M2S(INCLUDE_PATH/inc_common.cl)
|
||||
#include M2S(INCLUDE_PATH/inc_simd.cl)
|
||||
#include M2S(INCLUDE_PATH/inc_hash_sha1.cl)
|
||||
#endif
|
||||
|
||||
KERNEL_FQ void m32900_mxx (KERN_ATTR_VECTOR ())
|
||||
{
|
||||
/**
|
||||
* modifier
|
||||
*/
|
||||
|
||||
const u64 lid = get_local_id (0);
|
||||
const u64 gid = get_global_id (0);
|
||||
|
||||
if (gid >= GID_CNT) return;
|
||||
|
||||
/**
|
||||
* base
|
||||
*/
|
||||
|
||||
const u32 pw_len = pws[gid].pw_len;
|
||||
|
||||
u32x w[64] = { 0 };
|
||||
|
||||
for (u32 i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
|
||||
{
|
||||
w[idx] = pws[gid].i[idx];
|
||||
}
|
||||
|
||||
const u32 salt_len = salt_bufs[SALT_POS_HOST].salt_len;
|
||||
|
||||
u32x s[64] = { 0 };
|
||||
|
||||
for (u32 i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
|
||||
{
|
||||
s[idx] = hc_swap32_S (salt_bufs[SALT_POS_HOST].salt_buf[idx]);
|
||||
}
|
||||
|
||||
const u32 salt_iter = salt_bufs[SALT_POS_HOST].salt_iter;
|
||||
|
||||
sha1_ctx_vector_t ctx0;
|
||||
sha1_init_vector (&ctx0);
|
||||
|
||||
/**
|
||||
* loop
|
||||
*/
|
||||
|
||||
u32x w0l = w[0];
|
||||
|
||||
for (u32 il_pos = 0; il_pos < IL_CNT; il_pos++)
|
||||
{
|
||||
const u32x w0r = words_buf_r[il_pos / VECT_SIZE];
|
||||
|
||||
const u32x w0 = w0l | w0r;
|
||||
|
||||
w[0] = w0;
|
||||
|
||||
sha1_ctx_vector_t ctx1 = ctx0;
|
||||
|
||||
sha1_update_vector (&ctx1, w, pw_len);
|
||||
|
||||
sha1_update_vector (&ctx1, s, salt_len);
|
||||
|
||||
sha1_final_vector (&ctx1);
|
||||
|
||||
u32x buf[5];
|
||||
|
||||
buf[0] = ctx1.h[0];
|
||||
buf[1] = ctx1.h[1];
|
||||
buf[2] = ctx1.h[2];
|
||||
buf[3] = ctx1.h[3];
|
||||
buf[4] = ctx1.h[4];
|
||||
|
||||
for (int i = 0; i < salt_iter; i++)
|
||||
{
|
||||
sha1_ctx_vector_t ctx = ctx0;
|
||||
|
||||
ctx.w0[0] = buf[0];
|
||||
ctx.w0[1] = buf[1];
|
||||
ctx.w0[2] = buf[2];
|
||||
ctx.w0[3] = buf[3];
|
||||
ctx.w1[0] = buf[4];
|
||||
|
||||
ctx.len = 20;
|
||||
|
||||
sha1_final_vector (&ctx);
|
||||
|
||||
buf[0] = ctx.h[0];
|
||||
buf[1] = ctx.h[1];
|
||||
buf[2] = ctx.h[2];
|
||||
buf[3] = ctx.h[3];
|
||||
buf[4] = ctx.h[4];
|
||||
}
|
||||
|
||||
const u32x r0 = buf[DGST_R0];
|
||||
const u32x r1 = buf[DGST_R1];
|
||||
const u32x r2 = buf[DGST_R2];
|
||||
const u32x r3 = buf[DGST_R3];
|
||||
|
||||
COMPARE_M_SIMD (r0, r1, r2, r3);
|
||||
}
|
||||
}
|
||||
|
||||
KERNEL_FQ void m32900_sxx (KERN_ATTR_VECTOR ())
|
||||
{
|
||||
/**
|
||||
* modifier
|
||||
*/
|
||||
|
||||
const u64 lid = get_local_id (0);
|
||||
const u64 gid = get_global_id (0);
|
||||
|
||||
if (gid >= GID_CNT) return;
|
||||
|
||||
/**
|
||||
* digest
|
||||
*/
|
||||
|
||||
const u32 search[4] =
|
||||
{
|
||||
digests_buf[DIGESTS_OFFSET_HOST].digest_buf[DGST_R0],
|
||||
digests_buf[DIGESTS_OFFSET_HOST].digest_buf[DGST_R1],
|
||||
digests_buf[DIGESTS_OFFSET_HOST].digest_buf[DGST_R2],
|
||||
digests_buf[DIGESTS_OFFSET_HOST].digest_buf[DGST_R3]
|
||||
};
|
||||
|
||||
/**
|
||||
* base
|
||||
*/
|
||||
|
||||
const u32 pw_len = pws[gid].pw_len;
|
||||
|
||||
u32x w[64] = { 0 };
|
||||
|
||||
for (u32 i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
|
||||
{
|
||||
w[idx] = pws[gid].i[idx];
|
||||
}
|
||||
|
||||
const u32 salt_len = salt_bufs[SALT_POS_HOST].salt_len;
|
||||
|
||||
u32x s[64] = { 0 };
|
||||
|
||||
for (u32 i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
|
||||
{
|
||||
s[idx] = hc_swap32_S (salt_bufs[SALT_POS_HOST].salt_buf[idx]);
|
||||
}
|
||||
|
||||
const u32 salt_iter = salt_bufs[SALT_POS_HOST].salt_iter;
|
||||
|
||||
sha1_ctx_vector_t ctx0;
|
||||
sha1_init_vector (&ctx0);
|
||||
|
||||
/**
|
||||
* loop
|
||||
*/
|
||||
|
||||
u32x w0l = w[0];
|
||||
|
||||
for (u32 il_pos = 0; il_pos < IL_CNT; il_pos++)
|
||||
{
|
||||
const u32x w0r = words_buf_r[il_pos / VECT_SIZE];
|
||||
|
||||
const u32x w0 = w0l | w0r;
|
||||
|
||||
w[0] = w0;
|
||||
|
||||
sha1_ctx_vector_t ctx1 = ctx0;
|
||||
|
||||
sha1_update_vector (&ctx1, w, pw_len);
|
||||
|
||||
sha1_update_vector (&ctx1, s, salt_len);
|
||||
|
||||
sha1_final_vector (&ctx1);
|
||||
|
||||
u32x buf[5];
|
||||
|
||||
buf[0] = ctx1.h[0];
|
||||
buf[1] = ctx1.h[1];
|
||||
buf[2] = ctx1.h[2];
|
||||
buf[3] = ctx1.h[3];
|
||||
buf[4] = ctx1.h[4];
|
||||
|
||||
for (int i = 0; i < salt_iter; i++)
|
||||
{
|
||||
sha1_ctx_vector_t ctx = ctx0;
|
||||
|
||||
ctx.w0[0] = buf[0];
|
||||
ctx.w0[1] = buf[1];
|
||||
ctx.w0[2] = buf[2];
|
||||
ctx.w0[3] = buf[3];
|
||||
ctx.w1[0] = buf[4];
|
||||
|
||||
ctx.len = 20;
|
||||
|
||||
sha1_final_vector (&ctx);
|
||||
|
||||
buf[0] = ctx.h[0];
|
||||
buf[1] = ctx.h[1];
|
||||
buf[2] = ctx.h[2];
|
||||
buf[3] = ctx.h[3];
|
||||
buf[4] = ctx.h[4];
|
||||
}
|
||||
|
||||
const u32x r0 = buf[DGST_R0];
|
||||
const u32x r1 = buf[DGST_R1];
|
||||
const u32x r2 = buf[DGST_R2];
|
||||
const u32x r3 = buf[DGST_R3];
|
||||
|
||||
COMPARE_S_SIMD (r0, r1, r2, r3);
|
||||
}
|
||||
}
|
@ -10,7 +10,7 @@
|
||||
#include "convert.h"
|
||||
#include "shared.h"
|
||||
|
||||
static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL;
|
||||
static const u32 ATTACK_EXEC = ATTACK_EXEC_OUTSIDE_KERNEL;
|
||||
static const u32 DGST_POS0 = 3;
|
||||
static const u32 DGST_POS1 = 4;
|
||||
static const u32 DGST_POS2 = 2;
|
||||
@ -19,17 +19,21 @@ static const u32 DGST_SIZE = DGST_SIZE_4_5;
|
||||
static const u32 HASH_CATEGORY = HASH_CATEGORY_FRAMEWORK;
|
||||
static const char *HASH_NAME = "PBKDF1-SHA1";
|
||||
static const u64 KERN_TYPE = 32900;
|
||||
static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE
|
||||
| OPTI_TYPE_APPENDED_SALT
|
||||
| OPTI_TYPE_RAW_HASH;
|
||||
static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE;
|
||||
static const u64 OPTS_TYPE = OPTS_TYPE_STOCK_MODULE
|
||||
| OPTS_TYPE_PT_GENERATE_BE
|
||||
| OPTS_TYPE_PT_ADD80
|
||||
| OPTS_TYPE_PT_ADDBITS15;
|
||||
| OPTS_TYPE_PT_GENERATE_LE;
|
||||
static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED;
|
||||
static const char *ST_PASS = "hashcat";
|
||||
static const char *ST_HASH = "PBKDF1:sha1:1000:cGVuZ3VpbmtlZXBlcg==:J4BrIhXDUHNQ9lPPrWKn4V7Of9Y=";
|
||||
|
||||
typedef struct pbkdf1_sha1_tmp
|
||||
{
|
||||
u32 digest_buf[5];
|
||||
} pbkdf1_sha1_tmp;
|
||||
|
||||
static const char *SIGNATURE_PBKDF1 = "PBKDF1";
|
||||
static const char *SIGNATURE_SHA1 = "sha1";
|
||||
|
||||
u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; }
|
||||
u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; }
|
||||
u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; }
|
||||
@ -45,8 +49,11 @@ u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig,
|
||||
const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; }
|
||||
const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; }
|
||||
|
||||
static const char *SIGNATURE_PBKDF1 = "PBKDF1";
|
||||
static const char *SIGNATURE_SHA1 = "sha1";
|
||||
u64 module_tmp_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra)
|
||||
{
|
||||
const u64 tmp_size = (const u64) sizeof (pbkdf1_sha1_tmp);
|
||||
return tmp_size;
|
||||
}
|
||||
|
||||
int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len)
|
||||
{
|
||||
@ -248,7 +255,7 @@ void module_init (module_ctx_t *module_ctx)
|
||||
module_ctx->module_separator = MODULE_DEFAULT;
|
||||
module_ctx->module_st_hash = module_st_hash;
|
||||
module_ctx->module_st_pass = module_st_pass;
|
||||
module_ctx->module_tmp_size = MODULE_DEFAULT;
|
||||
module_ctx->module_tmp_size = module_tmp_size;
|
||||
module_ctx->module_unstable_warning = MODULE_DEFAULT;
|
||||
module_ctx->module_warmup_disable = MODULE_DEFAULT;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user