mirror of
https://github.com/hashcat/hashcat
synced 2024-11-13 17:28:58 +01:00
Vectorized WinZip and added support for long passwords
This commit is contained in:
parent
1049fa386a
commit
b1a88da83e
175
OpenCL/m13600.cl
175
OpenCL/m13600.cl
@ -117,7 +117,24 @@ __kernel void m13600_init (__global pw_t *pws, __global const kernel_rule_t *rul
|
||||
tmps[gid].opad[3] = sha1_hmac_ctx.opad.h[3];
|
||||
tmps[gid].opad[4] = sha1_hmac_ctx.opad.h[4];
|
||||
|
||||
sha1_hmac_update_global_swap (&sha1_hmac_ctx, esalt_bufs[digests_offset].salt_buf, esalt_bufs[digests_offset].salt_len);
|
||||
w0[0] = swap32_S (esalt_bufs[digests_offset].salt_buf[0]);
|
||||
w0[1] = swap32_S (esalt_bufs[digests_offset].salt_buf[1]);
|
||||
w0[2] = swap32_S (esalt_bufs[digests_offset].salt_buf[2]);
|
||||
w0[3] = swap32_S (esalt_bufs[digests_offset].salt_buf[3]);
|
||||
w1[0] = 0;
|
||||
w1[1] = 0;
|
||||
w1[2] = 0;
|
||||
w1[3] = 0;
|
||||
w2[0] = 0;
|
||||
w2[1] = 0;
|
||||
w2[2] = 0;
|
||||
w2[3] = 0;
|
||||
w3[0] = 0;
|
||||
w3[1] = 0;
|
||||
w3[2] = 0;
|
||||
w3[3] = 0;
|
||||
|
||||
sha1_hmac_update_64 (&sha1_hmac_ctx, w0, w1, w2, w3, esalt_bufs[digests_offset].salt_len);
|
||||
|
||||
const u32 mode = esalt_bufs[digests_offset].mode;
|
||||
|
||||
@ -143,8 +160,6 @@ __kernel void m13600_init (__global pw_t *pws, __global const kernel_rule_t *rul
|
||||
|
||||
for (u32 i = iter_start, j = count_start; i < iter_stop; i++, j++)
|
||||
{
|
||||
const u32 i5 = i * 5;
|
||||
|
||||
sha1_hmac_ctx_t sha1_hmac_ctx2 = sha1_hmac_ctx;
|
||||
|
||||
w0[0] = j;
|
||||
@ -168,6 +183,8 @@ __kernel void m13600_init (__global pw_t *pws, __global const kernel_rule_t *rul
|
||||
|
||||
sha1_hmac_final (&sha1_hmac_ctx2);
|
||||
|
||||
const u32 i5 = i * 5;
|
||||
|
||||
tmps[gid].dgst[i5 + 0] = sha1_hmac_ctx2.opad.h[0];
|
||||
tmps[gid].dgst[i5 + 1] = sha1_hmac_ctx2.opad.h[1];
|
||||
tmps[gid].dgst[i5 + 2] = sha1_hmac_ctx2.opad.h[2];
|
||||
@ -186,23 +203,22 @@ __kernel void m13600_loop (__global pw_t *pws, __global const kernel_rule_t *rul
|
||||
{
|
||||
const u32 gid = get_global_id (0);
|
||||
|
||||
if (gid >= gid_max) return;
|
||||
if ((gid * VECT_SIZE) >= gid_max) return;
|
||||
|
||||
u32 ipad[5];
|
||||
u32x ipad[5];
|
||||
u32x opad[5];
|
||||
|
||||
ipad[0] = tmps[gid].ipad[0];
|
||||
ipad[1] = tmps[gid].ipad[1];
|
||||
ipad[2] = tmps[gid].ipad[2];
|
||||
ipad[3] = tmps[gid].ipad[3];
|
||||
ipad[4] = tmps[gid].ipad[4];
|
||||
ipad[0] = packv (tmps, ipad, gid, 0);
|
||||
ipad[1] = packv (tmps, ipad, gid, 1);
|
||||
ipad[2] = packv (tmps, ipad, gid, 2);
|
||||
ipad[3] = packv (tmps, ipad, gid, 3);
|
||||
ipad[4] = packv (tmps, ipad, gid, 4);
|
||||
|
||||
u32 opad[5];
|
||||
|
||||
opad[0] = tmps[gid].opad[0];
|
||||
opad[1] = tmps[gid].opad[1];
|
||||
opad[2] = tmps[gid].opad[2];
|
||||
opad[3] = tmps[gid].opad[3];
|
||||
opad[4] = tmps[gid].opad[4];
|
||||
opad[0] = packv (tmps, opad, gid, 0);
|
||||
opad[1] = packv (tmps, opad, gid, 1);
|
||||
opad[2] = packv (tmps, opad, gid, 2);
|
||||
opad[3] = packv (tmps, opad, gid, 3);
|
||||
opad[4] = packv (tmps, opad, gid, 4);
|
||||
|
||||
const u32 mode = esalt_bufs[digests_offset].mode;
|
||||
|
||||
@ -230,28 +246,27 @@ __kernel void m13600_loop (__global pw_t *pws, __global const kernel_rule_t *rul
|
||||
{
|
||||
const u32 i5 = i * 5;
|
||||
|
||||
u32 dgst[5];
|
||||
u32x dgst[5];
|
||||
u32x out[5];
|
||||
|
||||
dgst[0] = tmps[gid].dgst[i5 + 0];
|
||||
dgst[1] = tmps[gid].dgst[i5 + 1];
|
||||
dgst[2] = tmps[gid].dgst[i5 + 2];
|
||||
dgst[3] = tmps[gid].dgst[i5 + 3];
|
||||
dgst[4] = tmps[gid].dgst[i5 + 4];
|
||||
dgst[0] = packv (tmps, dgst, gid, i5 + 0);
|
||||
dgst[1] = packv (tmps, dgst, gid, i5 + 1);
|
||||
dgst[2] = packv (tmps, dgst, gid, i5 + 2);
|
||||
dgst[3] = packv (tmps, dgst, gid, i5 + 3);
|
||||
dgst[4] = packv (tmps, dgst, gid, i5 + 4);
|
||||
|
||||
u32 out[5];
|
||||
out[0] = packv (tmps, out, gid, i5 + 0);
|
||||
out[1] = packv (tmps, out, gid, i5 + 1);
|
||||
out[2] = packv (tmps, out, gid, i5 + 2);
|
||||
out[3] = packv (tmps, out, gid, i5 + 3);
|
||||
out[4] = packv (tmps, out, gid, i5 + 4);
|
||||
|
||||
out[0] = tmps[gid].out[i5 + 0];
|
||||
out[1] = tmps[gid].out[i5 + 1];
|
||||
out[2] = tmps[gid].out[i5 + 2];
|
||||
out[3] = tmps[gid].out[i5 + 3];
|
||||
out[4] = tmps[gid].out[i5 + 4];
|
||||
|
||||
for (u32 k = 0; k < loop_cnt; k++)
|
||||
for (u32 j = 0; j < loop_cnt; j++)
|
||||
{
|
||||
u32 w0[4];
|
||||
u32 w1[4];
|
||||
u32 w2[4];
|
||||
u32 w3[4];
|
||||
u32x w0[4];
|
||||
u32x w1[4];
|
||||
u32x w2[4];
|
||||
u32x w3[4];
|
||||
|
||||
w0[0] = dgst[0];
|
||||
w0[1] = dgst[1];
|
||||
@ -270,7 +285,7 @@ __kernel void m13600_loop (__global pw_t *pws, __global const kernel_rule_t *rul
|
||||
w3[2] = 0;
|
||||
w3[3] = (64 + 20) * 8;
|
||||
|
||||
hmac_sha1_run (w0, w1, w2, w3, ipad, opad, dgst);
|
||||
hmac_sha1_run_V (w0, w1, w2, w3, ipad, opad, dgst);
|
||||
|
||||
out[0] ^= dgst[0];
|
||||
out[1] ^= dgst[1];
|
||||
@ -279,17 +294,17 @@ __kernel void m13600_loop (__global pw_t *pws, __global const kernel_rule_t *rul
|
||||
out[4] ^= dgst[4];
|
||||
}
|
||||
|
||||
tmps[gid].dgst[i5 + 0] = dgst[0];
|
||||
tmps[gid].dgst[i5 + 1] = dgst[1];
|
||||
tmps[gid].dgst[i5 + 2] = dgst[2];
|
||||
tmps[gid].dgst[i5 + 3] = dgst[3];
|
||||
tmps[gid].dgst[i5 + 4] = dgst[4];
|
||||
unpackv (tmps, dgst, gid, i5 + 0, dgst[0]);
|
||||
unpackv (tmps, dgst, gid, i5 + 1, dgst[1]);
|
||||
unpackv (tmps, dgst, gid, i5 + 2, dgst[2]);
|
||||
unpackv (tmps, dgst, gid, i5 + 3, dgst[3]);
|
||||
unpackv (tmps, dgst, gid, i5 + 4, dgst[4]);
|
||||
|
||||
tmps[gid].out[i5 + 0] = out[0];
|
||||
tmps[gid].out[i5 + 1] = out[1];
|
||||
tmps[gid].out[i5 + 2] = out[2];
|
||||
tmps[gid].out[i5 + 3] = out[3];
|
||||
tmps[gid].out[i5 + 4] = out[4];
|
||||
unpackv (tmps, out, gid, i5 + 0, out[0]);
|
||||
unpackv (tmps, out, gid, i5 + 1, out[1]);
|
||||
unpackv (tmps, out, gid, i5 + 2, out[2]);
|
||||
unpackv (tmps, out, gid, i5 + 3, out[3]);
|
||||
unpackv (tmps, out, gid, i5 + 4, out[4]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -305,8 +320,6 @@ __kernel void m13600_comp (__global pw_t *pws, __global const kernel_rule_t *rul
|
||||
|
||||
const u32 lid = get_local_id (0);
|
||||
|
||||
u32 key[8] = { 0 };
|
||||
|
||||
const u32 mode = esalt_bufs[digests_offset].mode;
|
||||
|
||||
u32 iter_start;
|
||||
@ -325,8 +338,9 @@ __kernel void m13600_comp (__global pw_t *pws, __global const kernel_rule_t *rul
|
||||
break;
|
||||
}
|
||||
|
||||
u32 i, j;
|
||||
for (i = iter_start, j = 0; i < iter_stop; i++, j++)
|
||||
u32 key[8] = { 0 };
|
||||
|
||||
for (int i = iter_start, j = 0; i < iter_stop; i++, j++)
|
||||
{
|
||||
key[j] = tmps[gid].out[i];
|
||||
}
|
||||
@ -353,63 +367,18 @@ __kernel void m13600_comp (__global pw_t *pws, __global const kernel_rule_t *rul
|
||||
w3[2] = 0;
|
||||
w3[3] = 0;
|
||||
|
||||
u32 ipad[5];
|
||||
u32 opad[5];
|
||||
sha1_hmac_ctx_t ctx;
|
||||
|
||||
hmac_sha1_pad (w0, w1, w2, w3, ipad, opad);
|
||||
sha1_hmac_init (&ctx, w0, w1, w2, w3);
|
||||
|
||||
int data_len = esalt_bufs[digests_offset].data_len;
|
||||
sha1_hmac_update_global_swap (&ctx, esalt_bufs[digests_offset].data_buf, esalt_bufs[digests_offset].data_len);
|
||||
|
||||
int data_left;
|
||||
int data_off;
|
||||
sha1_hmac_final (&ctx);
|
||||
|
||||
for (data_left = data_len, data_off = 0; data_left >= 56; data_left -= 64, data_off += 16)
|
||||
{
|
||||
w0[0] = swap32 (esalt_bufs[digests_offset].data_buf[data_off + 0]);
|
||||
w0[1] = swap32 (esalt_bufs[digests_offset].data_buf[data_off + 1]);
|
||||
w0[2] = swap32 (esalt_bufs[digests_offset].data_buf[data_off + 2]);
|
||||
w0[3] = swap32 (esalt_bufs[digests_offset].data_buf[data_off + 3]);
|
||||
w1[0] = swap32 (esalt_bufs[digests_offset].data_buf[data_off + 4]);
|
||||
w1[1] = swap32 (esalt_bufs[digests_offset].data_buf[data_off + 5]);
|
||||
w1[2] = swap32 (esalt_bufs[digests_offset].data_buf[data_off + 6]);
|
||||
w1[3] = swap32 (esalt_bufs[digests_offset].data_buf[data_off + 7]);
|
||||
w2[0] = swap32 (esalt_bufs[digests_offset].data_buf[data_off + 8]);
|
||||
w2[1] = swap32 (esalt_bufs[digests_offset].data_buf[data_off + 9]);
|
||||
w2[2] = swap32 (esalt_bufs[digests_offset].data_buf[data_off + 10]);
|
||||
w2[3] = swap32 (esalt_bufs[digests_offset].data_buf[data_off + 11]);
|
||||
w3[0] = swap32 (esalt_bufs[digests_offset].data_buf[data_off + 12]);
|
||||
w3[1] = swap32 (esalt_bufs[digests_offset].data_buf[data_off + 13]);
|
||||
w3[2] = swap32 (esalt_bufs[digests_offset].data_buf[data_off + 14]);
|
||||
w3[3] = swap32 (esalt_bufs[digests_offset].data_buf[data_off + 15]);
|
||||
|
||||
sha1_transform (w0, w1, w2, w3, ipad);
|
||||
}
|
||||
|
||||
w0[0] = swap32 (esalt_bufs[digests_offset].data_buf[data_off + 0]);
|
||||
w0[1] = swap32 (esalt_bufs[digests_offset].data_buf[data_off + 1]);
|
||||
w0[2] = swap32 (esalt_bufs[digests_offset].data_buf[data_off + 2]);
|
||||
w0[3] = swap32 (esalt_bufs[digests_offset].data_buf[data_off + 3]);
|
||||
w1[0] = swap32 (esalt_bufs[digests_offset].data_buf[data_off + 4]);
|
||||
w1[1] = swap32 (esalt_bufs[digests_offset].data_buf[data_off + 5]);
|
||||
w1[2] = swap32 (esalt_bufs[digests_offset].data_buf[data_off + 6]);
|
||||
w1[3] = swap32 (esalt_bufs[digests_offset].data_buf[data_off + 7]);
|
||||
w2[0] = swap32 (esalt_bufs[digests_offset].data_buf[data_off + 8]);
|
||||
w2[1] = swap32 (esalt_bufs[digests_offset].data_buf[data_off + 9]);
|
||||
w2[2] = swap32 (esalt_bufs[digests_offset].data_buf[data_off + 10]);
|
||||
w2[3] = swap32 (esalt_bufs[digests_offset].data_buf[data_off + 11]);
|
||||
w3[0] = swap32 (esalt_bufs[digests_offset].data_buf[data_off + 12]);
|
||||
w3[1] = swap32 (esalt_bufs[digests_offset].data_buf[data_off + 13]);
|
||||
w3[2] = 0;
|
||||
w3[3] = (64 + data_len) * 8;
|
||||
|
||||
u32 digest[5];
|
||||
|
||||
hmac_sha1_run (w0, w1, w2, w3, ipad, opad, digest);
|
||||
|
||||
const u32 r0 = swap32 (digest[0] & 0xffffffff);
|
||||
const u32 r1 = swap32 (digest[1] & 0xffffffff);
|
||||
const u32 r2 = swap32 (digest[2] & 0xffff0000);
|
||||
const u32 r3 = swap32 (digest[3] & 0x00000000);
|
||||
const u32 r0 = swap32_S (ctx.opad.h[0] & 0xffffffff);
|
||||
const u32 r1 = swap32_S (ctx.opad.h[1] & 0xffffffff);
|
||||
const u32 r2 = swap32_S (ctx.opad.h[2] & 0xffff0000);
|
||||
const u32 r3 = swap32_S (ctx.opad.h[3] & 0x00000000);
|
||||
|
||||
#define il_pos 0
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user