1
0
mirror of https://github.com/hashcat/hashcat.git synced 2024-11-22 16:18:09 +00:00

Unify some variable names in pure kernels

This commit is contained in:
jsteube 2017-07-12 15:58:58 +02:00
parent facf7ad534
commit 0113aedfdd
9 changed files with 171 additions and 84 deletions

View File

@ -79,6 +79,18 @@ __kernel void m00000_sxx (__global pw_t *pws, __global const kernel_rule_t *rule
if (gid >= gid_max) return;
/**
* 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]
};
/**
* base
*/
@ -96,18 +108,6 @@ __kernel void m00000_sxx (__global pw_t *pws, __global const kernel_rule_t *rule
barrier (CLK_GLOBAL_MEM_FENCE);
}
/**
* 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
*/

View File

@ -28,11 +28,11 @@ __kernel void m00000_mxx (__global pw_t *pws, __global const kernel_rule_t *rule
* base
*/
md5_ctx_t ctx_outer;
md5_ctx_t ctx0;
md5_init (&ctx_outer);
md5_init (&ctx0);
md5_update_global (&ctx_outer, pws[gid].i, pws[gid].pw_len);
md5_update_global (&ctx0, pws[gid].i, pws[gid].pw_len);
/**
* loop
@ -40,11 +40,11 @@ __kernel void m00000_mxx (__global pw_t *pws, __global const kernel_rule_t *rule
for (u32 il_pos = 0; il_pos < il_cnt; il_pos++)
{
md5_ctx_t ctx_inner = ctx_outer;
md5_ctx_t ctx = ctx0;
md5_update_global (&ctx_inner, combs_buf[il_pos].i, combs_buf[il_pos].pw_len);
md5_update_global (&ctx, combs_buf[il_pos].i, combs_buf[il_pos].pw_len);
md5_final (&ctx_inner);
md5_final (&ctx);
const u32 r0 = ctx.h[DGST_R0];
const u32 r1 = ctx.h[DGST_R1];
@ -82,11 +82,11 @@ __kernel void m00000_sxx (__global pw_t *pws, __global const kernel_rule_t *rule
* base
*/
md5_ctx_t ctx_outer;
md5_ctx_t ctx0;
md5_init (&ctx_outer);
md5_init (&ctx0);
md5_update_global (&ctx_outer, pws[gid].i, pws[gid].pw_len);
md5_update_global (&ctx0, pws[gid].i, pws[gid].pw_len);
/**
* loop
@ -94,11 +94,11 @@ __kernel void m00000_sxx (__global pw_t *pws, __global const kernel_rule_t *rule
for (u32 il_pos = 0; il_pos < il_cnt; il_pos++)
{
md5_ctx_t ctx_inner = ctx_outer;
md5_ctx_t ctx = ctx0;
md5_update_global (&ctx_inner, combs_buf[il_pos].i, combs_buf[il_pos].pw_len);
md5_update_global (&ctx, combs_buf[il_pos].i, combs_buf[il_pos].pw_len);
md5_final (&ctx_inner);
md5_final (&ctx);
const u32 r0 = ctx.h[DGST_R0];
const u32 r1 = ctx.h[DGST_R1];

View File

@ -17,6 +17,59 @@
__kernel void m00020_mxx (__global pw_t *pws, __global const kernel_rule_t *rules_buf, __global const pw_t *combs_buf, __global const bf_t *bfs_buf, __global void *tmps, __global void *hooks, __global const u32 *bitmaps_buf_s1_a, __global const u32 *bitmaps_buf_s1_b, __global const u32 *bitmaps_buf_s1_c, __global const u32 *bitmaps_buf_s1_d, __global const u32 *bitmaps_buf_s2_a, __global const u32 *bitmaps_buf_s2_b, __global const u32 *bitmaps_buf_s2_c, __global const u32 *bitmaps_buf_s2_d, __global plain_t *plains_buf, __global const digest_t *digests_buf, __global u32 *hashes_shown, __global const salt_t *salt_bufs, __global const void *esalt_bufs, __global u32 *d_return_buf, __global u32 *d_scryptV0_buf, __global u32 *d_scryptV1_buf, __global u32 *d_scryptV2_buf, __global u32 *d_scryptV3_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)
{
/**
* modifier
*/
const u32 lid = get_local_id (0);
const u32 gid = get_global_id (0);
if (gid >= gid_max) return;
/**
* base
*/
const u32 pw_len = pws[gid].pw_len;
const u32 pw_lenv = ceil ((float) pw_len / 4);
u32 w[64] = { 0 };
for (int idx = 0; idx < pw_lenv; idx++)
{
w[idx] = pws[gid].i[idx];
barrier (CLK_GLOBAL_MEM_FENCE);
}
md5_ctx_t ctx0;
md5_init (&ctx0);
md5_update_global (&ctx0, salt_bufs[salt_pos].salt_buf, salt_bufs[salt_pos].salt_len);
/**
* loop
*/
for (u32 il_pos = 0; il_pos < il_cnt; il_pos++)
{
// todo: add rules engine
md5_ctx_t ctx = ctx0;
md5_update (&ctx, w, pw_len);
md5_final (&ctx);
const u32 r0 = ctx.h[DGST_R0];
const u32 r1 = ctx.h[DGST_R1];
const u32 r2 = ctx.h[DGST_R2];
const u32 r3 = ctx.h[DGST_R3];
COMPARE_M_SCALAR (r0, r1, r2, r3);
}
}
__kernel void m00020_sxx (__global pw_t *pws, __global const kernel_rule_t *rules_buf, __global const pw_t *combs_buf, __global const bf_t *bfs_buf, __global void *tmps, __global void *hooks, __global const u32 *bitmaps_buf_s1_a, __global const u32 *bitmaps_buf_s1_b, __global const u32 *bitmaps_buf_s1_c, __global const u32 *bitmaps_buf_s1_d, __global const u32 *bitmaps_buf_s2_a, __global const u32 *bitmaps_buf_s2_b, __global const u32 *bitmaps_buf_s2_c, __global const u32 *bitmaps_buf_s2_d, __global plain_t *plains_buf, __global const digest_t *digests_buf, __global u32 *hashes_shown, __global const salt_t *salt_bufs, __global const void *esalt_bufs, __global u32 *d_return_buf, __global u32 *d_scryptV0_buf, __global u32 *d_scryptV1_buf, __global u32 *d_scryptV2_buf, __global u32 *d_scryptV3_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)

View File

@ -79,6 +79,18 @@ __kernel void m01700_sxx (__global pw_t *pws, __global const kernel_rule_t *rule
if (gid >= gid_max) return;
/**
* 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]
};
/**
* base
*/
@ -96,18 +108,6 @@ __kernel void m01700_sxx (__global pw_t *pws, __global const kernel_rule_t *rule
barrier (CLK_GLOBAL_MEM_FENCE);
}
/**
* 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
*/

View File

@ -28,11 +28,11 @@ __kernel void m01700_mxx (__global pw_t *pws, __global const kernel_rule_t *rule
* base
*/
sha512_ctx_t ctx_outer;
sha512_ctx_t ctx0;
sha512_init (&ctx_outer);
sha512_init (&ctx0);
sha512_update_global (&ctx_outer, pws[gid].i, pws[gid].pw_len);
sha512_update_global (&ctx0, pws[gid].i, pws[gid].pw_len);
/**
* loop
@ -40,11 +40,11 @@ __kernel void m01700_mxx (__global pw_t *pws, __global const kernel_rule_t *rule
for (u32 il_pos = 0; il_pos < il_cnt; il_pos++)
{
sha512_ctx_t ctx_inner = ctx_outer;
sha512_ctx_t ctx = ctx0;
sha512_update_global (&ctx_inner, combs_buf[il_pos].i, combs_buf[il_pos].pw_len);
sha512_update_global (&ctx, combs_buf[il_pos].i, combs_buf[il_pos].pw_len);
sha512_final (&ctx_inner);
sha512_final (&ctx);
const u32x r0 = l32_from_64 (ctx.h[7]);
const u32x r1 = h32_from_64 (ctx.h[7]);
@ -82,11 +82,11 @@ __kernel void m01700_sxx (__global pw_t *pws, __global const kernel_rule_t *rule
* base
*/
sha512_ctx_t ctx_outer;
sha512_ctx_t ctx0;
sha512_init (&ctx_outer);
sha512_init (&ctx0);
sha512_update_global (&ctx_outer, pws[gid].i, pws[gid].pw_len);
sha512_update_global (&ctx0, pws[gid].i, pws[gid].pw_len);
/**
* loop
@ -94,11 +94,11 @@ __kernel void m01700_sxx (__global pw_t *pws, __global const kernel_rule_t *rule
for (u32 il_pos = 0; il_pos < il_cnt; il_pos++)
{
sha512_ctx_t ctx_inner = ctx_outer;
sha512_ctx_t ctx = ctx0;
sha512_update_global (&ctx_inner, combs_buf[il_pos].i, combs_buf[il_pos].pw_len);
sha512_update_global (&ctx, combs_buf[il_pos].i, combs_buf[il_pos].pw_len);
sha512_final (&ctx_inner);
sha512_final (&ctx);
const u32x r0 = l32_from_64 (ctx.h[7]);
const u32x r1 = h32_from_64 (ctx.h[7]);

View File

@ -57,6 +57,23 @@ __kernel void m06100_mxx (__global pw_t *pws, __global const kernel_rule_t *rule
if (gid >= gid_max) return;
/**
* base
*/
const u32 pw_len = pws[gid].pw_len;
const u32 pw_lenv = ceil ((float) pw_len / 4);
u32 w[64] = { 0 };
for (int idx = 0; idx < pw_lenv; idx++)
{
w[idx] = pws[gid].i[idx];
barrier (CLK_GLOBAL_MEM_FENCE);
}
/**
* loop
*/
@ -136,6 +153,23 @@ __kernel void m06100_sxx (__global pw_t *pws, __global const kernel_rule_t *rule
digests_buf[digests_offset].digest_buf[DGST_R3]
};
/**
* base
*/
const u32 pw_len = pws[gid].pw_len;
const u32 pw_lenv = ceil ((float) pw_len / 4);
u32 w[64] = { 0 };
for (int idx = 0; idx < pw_lenv; idx++)
{
w[idx] = pws[gid].i[idx];
barrier (CLK_GLOBAL_MEM_FENCE);
}
/**
* loop
*/

View File

@ -59,11 +59,11 @@ __kernel void m06100_mxx (__global pw_t *pws, __global const kernel_rule_t *rule
* base
*/
whirlpool_ctx_t ctx_outer;
whirlpool_ctx_t ctx0;
whirlpool_init (&ctx_outer, s_Ch, s_Cl);
whirlpool_init (&ctx0, s_Ch, s_Cl);
whirlpool_update_global (&ctx_outer, pws[gid].i, pws[gid].pw_len);
whirlpool_update_global (&ctx0, pws[gid].i, pws[gid].pw_len);
/**
* loop
@ -71,11 +71,11 @@ __kernel void m06100_mxx (__global pw_t *pws, __global const kernel_rule_t *rule
for (u32 il_pos = 0; il_pos < il_cnt; il_pos++)
{
whirlpool_ctx_t ctx_inner = ctx_outer;
whirlpool_ctx_t ctx = ctx0;
whirlpool_update_global (&ctx_inner, combs_buf[il_pos].i, combs_buf[il_pos].pw_len);
whirlpool_update_global (&ctx, combs_buf[il_pos].i, combs_buf[il_pos].pw_len);
whirlpool_final (&ctx_inner);
whirlpool_final (&ctx);
const u32 r0 = ctx.h[DGST_R0];
const u32 r1 = ctx.h[DGST_R1];
@ -144,11 +144,11 @@ __kernel void m06100_sxx (__global pw_t *pws, __global const kernel_rule_t *rule
* base
*/
whirlpool_ctx_t ctx_outer;
whirlpool_ctx_t ctx0;
whirlpool_init (&ctx_outer, s_Ch, s_Cl);
whirlpool_init (&ctx0, s_Ch, s_Cl);
whirlpool_update_global (&ctx_outer, pws[gid].i, pws[gid].pw_len);
whirlpool_update_global (&ctx0, pws[gid].i, pws[gid].pw_len);
/**
* loop
@ -156,11 +156,11 @@ __kernel void m06100_sxx (__global pw_t *pws, __global const kernel_rule_t *rule
for (u32 il_pos = 0; il_pos < il_cnt; il_pos++)
{
whirlpool_ctx_t ctx_inner = ctx_outer;
whirlpool_ctx_t ctx = ctx0;
whirlpool_update_global (&ctx_inner, combs_buf[il_pos].i, combs_buf[il_pos].pw_len);
whirlpool_update_global (&ctx, combs_buf[il_pos].i, combs_buf[il_pos].pw_len);
whirlpool_final (&ctx_inner);
whirlpool_final (&ctx);
const u32 r0 = ctx.h[DGST_R0];
const u32 r1 = ctx.h[DGST_R1];

View File

@ -79,6 +79,18 @@ __kernel void m10800_sxx (__global pw_t *pws, __global const kernel_rule_t *rule
if (gid >= gid_max) return;
/**
* 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]
};
/**
* base
*/
@ -96,18 +108,6 @@ __kernel void m10800_sxx (__global pw_t *pws, __global const kernel_rule_t *rule
barrier (CLK_GLOBAL_MEM_FENCE);
}
/**
* 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
*/

View File

@ -28,11 +28,11 @@ __kernel void m10800_mxx (__global pw_t *pws, __global const kernel_rule_t *rule
* base
*/
sha384_ctx_t ctx_outer;
sha384_ctx_t ctx0;
sha384_init (&ctx_outer);
sha384_init (&ctx0);
sha384_update_global (&ctx_outer, pws[gid].i, pws[gid].pw_len);
sha384_update_global (&ctx0, pws[gid].i, pws[gid].pw_len);
/**
* loop
@ -40,11 +40,11 @@ __kernel void m10800_mxx (__global pw_t *pws, __global const kernel_rule_t *rule
for (u32 il_pos = 0; il_pos < il_cnt; il_pos++)
{
sha384_ctx_t ctx_inner = ctx_outer;
sha384_ctx_t ctx = ctx0;
sha384_update_global (&ctx_inner, combs_buf[il_pos].i, combs_buf[il_pos].pw_len);
sha384_update_global (&ctx, combs_buf[il_pos].i, combs_buf[il_pos].pw_len);
sha384_final (&ctx_inner);
sha384_final (&ctx);
const u32x r0 = l32_from_64 (ctx.h[3]);
const u32x r1 = h32_from_64 (ctx.h[3]);
@ -82,11 +82,11 @@ __kernel void m10800_sxx (__global pw_t *pws, __global const kernel_rule_t *rule
* base
*/
sha384_ctx_t ctx_outer;
sha384_ctx_t ctx0;
sha384_init (&ctx_outer);
sha384_init (&ctx0);
sha384_update_global (&ctx_outer, pws[gid].i, pws[gid].pw_len);
sha384_update_global (&ctx0, pws[gid].i, pws[gid].pw_len);
/**
* loop
@ -94,11 +94,11 @@ __kernel void m10800_sxx (__global pw_t *pws, __global const kernel_rule_t *rule
for (u32 il_pos = 0; il_pos < il_cnt; il_pos++)
{
sha384_ctx_t ctx_inner = ctx_outer;
sha384_ctx_t ctx = ctx0;
sha384_update_global (&ctx_inner, combs_buf[il_pos].i, combs_buf[il_pos].pw_len);
sha384_update_global (&ctx, combs_buf[il_pos].i, combs_buf[il_pos].pw_len);
sha384_final (&ctx_inner);
sha384_final (&ctx);
const u32x r0 = l32_from_64 (ctx.h[3]);
const u32x r1 = h32_from_64 (ctx.h[3]);