mirror of
https://github.com/hashcat/hashcat.git
synced 2025-01-03 12:21:07 +00:00
Prepare for WinZip integration
This commit is contained in:
parent
aefd3b03a3
commit
7a4ab2b42d
609
OpenCL/m13600.cl
Normal file
609
OpenCL/m13600.cl
Normal file
@ -0,0 +1,609 @@
|
||||
/**
|
||||
* Author......: Jens Steube <jens.steube@gmail.com>
|
||||
* License.....: MIT
|
||||
*/
|
||||
|
||||
#define _PBKDF2_SHA1_
|
||||
|
||||
#include "include/constants.h"
|
||||
#include "include/kernel_vendor.h"
|
||||
|
||||
#define DGST_R0 0
|
||||
#define DGST_R1 1
|
||||
#define DGST_R2 2
|
||||
#define DGST_R3 3
|
||||
|
||||
#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"
|
||||
|
||||
void sha1_transform (const u32 w0[4], const u32 w1[4], const u32 w2[4], const u32 w3[4], u32 digest[5])
|
||||
{
|
||||
u32 A = digest[0];
|
||||
u32 B = digest[1];
|
||||
u32 C = digest[2];
|
||||
u32 D = digest[3];
|
||||
u32 E = digest[4];
|
||||
|
||||
u32 w0_t = w0[0];
|
||||
u32 w1_t = w0[1];
|
||||
u32 w2_t = w0[2];
|
||||
u32 w3_t = w0[3];
|
||||
u32 w4_t = w1[0];
|
||||
u32 w5_t = w1[1];
|
||||
u32 w6_t = w1[2];
|
||||
u32 w7_t = w1[3];
|
||||
u32 w8_t = w2[0];
|
||||
u32 w9_t = w2[1];
|
||||
u32 wa_t = w2[2];
|
||||
u32 wb_t = w2[3];
|
||||
u32 wc_t = w3[0];
|
||||
u32 wd_t = w3[1];
|
||||
u32 we_t = w3[2];
|
||||
u32 wf_t = w3[3];
|
||||
|
||||
#undef K
|
||||
#define K SHA1C00
|
||||
|
||||
SHA1_STEP (SHA1_F0o, A, B, C, D, E, w0_t);
|
||||
SHA1_STEP (SHA1_F0o, E, A, B, C, D, w1_t);
|
||||
SHA1_STEP (SHA1_F0o, D, E, A, B, C, w2_t);
|
||||
SHA1_STEP (SHA1_F0o, C, D, E, A, B, w3_t);
|
||||
SHA1_STEP (SHA1_F0o, B, C, D, E, A, w4_t);
|
||||
SHA1_STEP (SHA1_F0o, A, B, C, D, E, w5_t);
|
||||
SHA1_STEP (SHA1_F0o, E, A, B, C, D, w6_t);
|
||||
SHA1_STEP (SHA1_F0o, D, E, A, B, C, w7_t);
|
||||
SHA1_STEP (SHA1_F0o, C, D, E, A, B, w8_t);
|
||||
SHA1_STEP (SHA1_F0o, B, C, D, E, A, w9_t);
|
||||
SHA1_STEP (SHA1_F0o, A, B, C, D, E, wa_t);
|
||||
SHA1_STEP (SHA1_F0o, E, A, B, C, D, wb_t);
|
||||
SHA1_STEP (SHA1_F0o, D, E, A, B, C, wc_t);
|
||||
SHA1_STEP (SHA1_F0o, C, D, E, A, B, wd_t);
|
||||
SHA1_STEP (SHA1_F0o, B, C, D, E, A, we_t);
|
||||
SHA1_STEP (SHA1_F0o, A, B, C, D, E, wf_t);
|
||||
w0_t = rotl32 ((wd_t ^ w8_t ^ w2_t ^ w0_t), 1u); SHA1_STEP (SHA1_F0o, E, A, B, C, D, w0_t);
|
||||
w1_t = rotl32 ((we_t ^ w9_t ^ w3_t ^ w1_t), 1u); SHA1_STEP (SHA1_F0o, D, E, A, B, C, w1_t);
|
||||
w2_t = rotl32 ((wf_t ^ wa_t ^ w4_t ^ w2_t), 1u); SHA1_STEP (SHA1_F0o, C, D, E, A, B, w2_t);
|
||||
w3_t = rotl32 ((w0_t ^ wb_t ^ w5_t ^ w3_t), 1u); SHA1_STEP (SHA1_F0o, B, C, D, E, A, w3_t);
|
||||
|
||||
#undef K
|
||||
#define K SHA1C01
|
||||
|
||||
w4_t = rotl32 ((w1_t ^ wc_t ^ w6_t ^ w4_t), 1u); SHA1_STEP (SHA1_F1, A, B, C, D, E, w4_t);
|
||||
w5_t = rotl32 ((w2_t ^ wd_t ^ w7_t ^ w5_t), 1u); SHA1_STEP (SHA1_F1, E, A, B, C, D, w5_t);
|
||||
w6_t = rotl32 ((w3_t ^ we_t ^ w8_t ^ w6_t), 1u); SHA1_STEP (SHA1_F1, D, E, A, B, C, w6_t);
|
||||
w7_t = rotl32 ((w4_t ^ wf_t ^ w9_t ^ w7_t), 1u); SHA1_STEP (SHA1_F1, C, D, E, A, B, w7_t);
|
||||
w8_t = rotl32 ((w5_t ^ w0_t ^ wa_t ^ w8_t), 1u); SHA1_STEP (SHA1_F1, B, C, D, E, A, w8_t);
|
||||
w9_t = rotl32 ((w6_t ^ w1_t ^ wb_t ^ w9_t), 1u); SHA1_STEP (SHA1_F1, A, B, C, D, E, w9_t);
|
||||
wa_t = rotl32 ((w7_t ^ w2_t ^ wc_t ^ wa_t), 1u); SHA1_STEP (SHA1_F1, E, A, B, C, D, wa_t);
|
||||
wb_t = rotl32 ((w8_t ^ w3_t ^ wd_t ^ wb_t), 1u); SHA1_STEP (SHA1_F1, D, E, A, B, C, wb_t);
|
||||
wc_t = rotl32 ((w9_t ^ w4_t ^ we_t ^ wc_t), 1u); SHA1_STEP (SHA1_F1, C, D, E, A, B, wc_t);
|
||||
wd_t = rotl32 ((wa_t ^ w5_t ^ wf_t ^ wd_t), 1u); SHA1_STEP (SHA1_F1, B, C, D, E, A, wd_t);
|
||||
we_t = rotl32 ((wb_t ^ w6_t ^ w0_t ^ we_t), 1u); SHA1_STEP (SHA1_F1, A, B, C, D, E, we_t);
|
||||
wf_t = rotl32 ((wc_t ^ w7_t ^ w1_t ^ wf_t), 1u); SHA1_STEP (SHA1_F1, E, A, B, C, D, wf_t);
|
||||
w0_t = rotl32 ((wd_t ^ w8_t ^ w2_t ^ w0_t), 1u); SHA1_STEP (SHA1_F1, D, E, A, B, C, w0_t);
|
||||
w1_t = rotl32 ((we_t ^ w9_t ^ w3_t ^ w1_t), 1u); SHA1_STEP (SHA1_F1, C, D, E, A, B, w1_t);
|
||||
w2_t = rotl32 ((wf_t ^ wa_t ^ w4_t ^ w2_t), 1u); SHA1_STEP (SHA1_F1, B, C, D, E, A, w2_t);
|
||||
w3_t = rotl32 ((w0_t ^ wb_t ^ w5_t ^ w3_t), 1u); SHA1_STEP (SHA1_F1, A, B, C, D, E, w3_t);
|
||||
w4_t = rotl32 ((w1_t ^ wc_t ^ w6_t ^ w4_t), 1u); SHA1_STEP (SHA1_F1, E, A, B, C, D, w4_t);
|
||||
w5_t = rotl32 ((w2_t ^ wd_t ^ w7_t ^ w5_t), 1u); SHA1_STEP (SHA1_F1, D, E, A, B, C, w5_t);
|
||||
w6_t = rotl32 ((w3_t ^ we_t ^ w8_t ^ w6_t), 1u); SHA1_STEP (SHA1_F1, C, D, E, A, B, w6_t);
|
||||
w7_t = rotl32 ((w4_t ^ wf_t ^ w9_t ^ w7_t), 1u); SHA1_STEP (SHA1_F1, B, C, D, E, A, w7_t);
|
||||
|
||||
#undef K
|
||||
#define K SHA1C02
|
||||
|
||||
w8_t = rotl32 ((w5_t ^ w0_t ^ wa_t ^ w8_t), 1u); SHA1_STEP (SHA1_F2o, A, B, C, D, E, w8_t);
|
||||
w9_t = rotl32 ((w6_t ^ w1_t ^ wb_t ^ w9_t), 1u); SHA1_STEP (SHA1_F2o, E, A, B, C, D, w9_t);
|
||||
wa_t = rotl32 ((w7_t ^ w2_t ^ wc_t ^ wa_t), 1u); SHA1_STEP (SHA1_F2o, D, E, A, B, C, wa_t);
|
||||
wb_t = rotl32 ((w8_t ^ w3_t ^ wd_t ^ wb_t), 1u); SHA1_STEP (SHA1_F2o, C, D, E, A, B, wb_t);
|
||||
wc_t = rotl32 ((w9_t ^ w4_t ^ we_t ^ wc_t), 1u); SHA1_STEP (SHA1_F2o, B, C, D, E, A, wc_t);
|
||||
wd_t = rotl32 ((wa_t ^ w5_t ^ wf_t ^ wd_t), 1u); SHA1_STEP (SHA1_F2o, A, B, C, D, E, wd_t);
|
||||
we_t = rotl32 ((wb_t ^ w6_t ^ w0_t ^ we_t), 1u); SHA1_STEP (SHA1_F2o, E, A, B, C, D, we_t);
|
||||
wf_t = rotl32 ((wc_t ^ w7_t ^ w1_t ^ wf_t), 1u); SHA1_STEP (SHA1_F2o, D, E, A, B, C, wf_t);
|
||||
w0_t = rotl32 ((wd_t ^ w8_t ^ w2_t ^ w0_t), 1u); SHA1_STEP (SHA1_F2o, C, D, E, A, B, w0_t);
|
||||
w1_t = rotl32 ((we_t ^ w9_t ^ w3_t ^ w1_t), 1u); SHA1_STEP (SHA1_F2o, B, C, D, E, A, w1_t);
|
||||
w2_t = rotl32 ((wf_t ^ wa_t ^ w4_t ^ w2_t), 1u); SHA1_STEP (SHA1_F2o, A, B, C, D, E, w2_t);
|
||||
w3_t = rotl32 ((w0_t ^ wb_t ^ w5_t ^ w3_t), 1u); SHA1_STEP (SHA1_F2o, E, A, B, C, D, w3_t);
|
||||
w4_t = rotl32 ((w1_t ^ wc_t ^ w6_t ^ w4_t), 1u); SHA1_STEP (SHA1_F2o, D, E, A, B, C, w4_t);
|
||||
w5_t = rotl32 ((w2_t ^ wd_t ^ w7_t ^ w5_t), 1u); SHA1_STEP (SHA1_F2o, C, D, E, A, B, w5_t);
|
||||
w6_t = rotl32 ((w3_t ^ we_t ^ w8_t ^ w6_t), 1u); SHA1_STEP (SHA1_F2o, B, C, D, E, A, w6_t);
|
||||
w7_t = rotl32 ((w4_t ^ wf_t ^ w9_t ^ w7_t), 1u); SHA1_STEP (SHA1_F2o, A, B, C, D, E, w7_t);
|
||||
w8_t = rotl32 ((w5_t ^ w0_t ^ wa_t ^ w8_t), 1u); SHA1_STEP (SHA1_F2o, E, A, B, C, D, w8_t);
|
||||
w9_t = rotl32 ((w6_t ^ w1_t ^ wb_t ^ w9_t), 1u); SHA1_STEP (SHA1_F2o, D, E, A, B, C, w9_t);
|
||||
wa_t = rotl32 ((w7_t ^ w2_t ^ wc_t ^ wa_t), 1u); SHA1_STEP (SHA1_F2o, C, D, E, A, B, wa_t);
|
||||
wb_t = rotl32 ((w8_t ^ w3_t ^ wd_t ^ wb_t), 1u); SHA1_STEP (SHA1_F2o, B, C, D, E, A, wb_t);
|
||||
|
||||
#undef K
|
||||
#define K SHA1C03
|
||||
|
||||
wc_t = rotl32 ((w9_t ^ w4_t ^ we_t ^ wc_t), 1u); SHA1_STEP (SHA1_F1, A, B, C, D, E, wc_t);
|
||||
wd_t = rotl32 ((wa_t ^ w5_t ^ wf_t ^ wd_t), 1u); SHA1_STEP (SHA1_F1, E, A, B, C, D, wd_t);
|
||||
we_t = rotl32 ((wb_t ^ w6_t ^ w0_t ^ we_t), 1u); SHA1_STEP (SHA1_F1, D, E, A, B, C, we_t);
|
||||
wf_t = rotl32 ((wc_t ^ w7_t ^ w1_t ^ wf_t), 1u); SHA1_STEP (SHA1_F1, C, D, E, A, B, wf_t);
|
||||
w0_t = rotl32 ((wd_t ^ w8_t ^ w2_t ^ w0_t), 1u); SHA1_STEP (SHA1_F1, B, C, D, E, A, w0_t);
|
||||
w1_t = rotl32 ((we_t ^ w9_t ^ w3_t ^ w1_t), 1u); SHA1_STEP (SHA1_F1, A, B, C, D, E, w1_t);
|
||||
w2_t = rotl32 ((wf_t ^ wa_t ^ w4_t ^ w2_t), 1u); SHA1_STEP (SHA1_F1, E, A, B, C, D, w2_t);
|
||||
w3_t = rotl32 ((w0_t ^ wb_t ^ w5_t ^ w3_t), 1u); SHA1_STEP (SHA1_F1, D, E, A, B, C, w3_t);
|
||||
w4_t = rotl32 ((w1_t ^ wc_t ^ w6_t ^ w4_t), 1u); SHA1_STEP (SHA1_F1, C, D, E, A, B, w4_t);
|
||||
w5_t = rotl32 ((w2_t ^ wd_t ^ w7_t ^ w5_t), 1u); SHA1_STEP (SHA1_F1, B, C, D, E, A, w5_t);
|
||||
w6_t = rotl32 ((w3_t ^ we_t ^ w8_t ^ w6_t), 1u); SHA1_STEP (SHA1_F1, A, B, C, D, E, w6_t);
|
||||
w7_t = rotl32 ((w4_t ^ wf_t ^ w9_t ^ w7_t), 1u); SHA1_STEP (SHA1_F1, E, A, B, C, D, w7_t);
|
||||
w8_t = rotl32 ((w5_t ^ w0_t ^ wa_t ^ w8_t), 1u); SHA1_STEP (SHA1_F1, D, E, A, B, C, w8_t);
|
||||
w9_t = rotl32 ((w6_t ^ w1_t ^ wb_t ^ w9_t), 1u); SHA1_STEP (SHA1_F1, C, D, E, A, B, w9_t);
|
||||
wa_t = rotl32 ((w7_t ^ w2_t ^ wc_t ^ wa_t), 1u); SHA1_STEP (SHA1_F1, B, C, D, E, A, wa_t);
|
||||
wb_t = rotl32 ((w8_t ^ w3_t ^ wd_t ^ wb_t), 1u); SHA1_STEP (SHA1_F1, A, B, C, D, E, wb_t);
|
||||
wc_t = rotl32 ((w9_t ^ w4_t ^ we_t ^ wc_t), 1u); SHA1_STEP (SHA1_F1, E, A, B, C, D, wc_t);
|
||||
wd_t = rotl32 ((wa_t ^ w5_t ^ wf_t ^ wd_t), 1u); SHA1_STEP (SHA1_F1, D, E, A, B, C, wd_t);
|
||||
we_t = rotl32 ((wb_t ^ w6_t ^ w0_t ^ we_t), 1u); SHA1_STEP (SHA1_F1, C, D, E, A, B, we_t);
|
||||
wf_t = rotl32 ((wc_t ^ w7_t ^ w1_t ^ wf_t), 1u); SHA1_STEP (SHA1_F1, B, C, D, E, A, wf_t);
|
||||
|
||||
digest[0] += A;
|
||||
digest[1] += B;
|
||||
digest[2] += C;
|
||||
digest[3] += D;
|
||||
digest[4] += E;
|
||||
}
|
||||
|
||||
void hmac_sha1_pad (u32 w0[4], u32 w1[4], u32 w2[4], u32 w3[4], u32 ipad[5], u32 opad[5])
|
||||
{
|
||||
w0[0] = w0[0] ^ 0x36363636;
|
||||
w0[1] = w0[1] ^ 0x36363636;
|
||||
w0[2] = w0[2] ^ 0x36363636;
|
||||
w0[3] = w0[3] ^ 0x36363636;
|
||||
w1[0] = w1[0] ^ 0x36363636;
|
||||
w1[1] = w1[1] ^ 0x36363636;
|
||||
w1[2] = w1[2] ^ 0x36363636;
|
||||
w1[3] = w1[3] ^ 0x36363636;
|
||||
w2[0] = w2[0] ^ 0x36363636;
|
||||
w2[1] = w2[1] ^ 0x36363636;
|
||||
w2[2] = w2[2] ^ 0x36363636;
|
||||
w2[3] = w2[3] ^ 0x36363636;
|
||||
w3[0] = w3[0] ^ 0x36363636;
|
||||
w3[1] = w3[1] ^ 0x36363636;
|
||||
w3[2] = w3[2] ^ 0x36363636;
|
||||
w3[3] = w3[3] ^ 0x36363636;
|
||||
|
||||
ipad[0] = SHA1M_A;
|
||||
ipad[1] = SHA1M_B;
|
||||
ipad[2] = SHA1M_C;
|
||||
ipad[3] = SHA1M_D;
|
||||
ipad[4] = SHA1M_E;
|
||||
|
||||
sha1_transform (w0, w1, w2, w3, ipad);
|
||||
|
||||
w0[0] = w0[0] ^ 0x6a6a6a6a;
|
||||
w0[1] = w0[1] ^ 0x6a6a6a6a;
|
||||
w0[2] = w0[2] ^ 0x6a6a6a6a;
|
||||
w0[3] = w0[3] ^ 0x6a6a6a6a;
|
||||
w1[0] = w1[0] ^ 0x6a6a6a6a;
|
||||
w1[1] = w1[1] ^ 0x6a6a6a6a;
|
||||
w1[2] = w1[2] ^ 0x6a6a6a6a;
|
||||
w1[3] = w1[3] ^ 0x6a6a6a6a;
|
||||
w2[0] = w2[0] ^ 0x6a6a6a6a;
|
||||
w2[1] = w2[1] ^ 0x6a6a6a6a;
|
||||
w2[2] = w2[2] ^ 0x6a6a6a6a;
|
||||
w2[3] = w2[3] ^ 0x6a6a6a6a;
|
||||
w3[0] = w3[0] ^ 0x6a6a6a6a;
|
||||
w3[1] = w3[1] ^ 0x6a6a6a6a;
|
||||
w3[2] = w3[2] ^ 0x6a6a6a6a;
|
||||
w3[3] = w3[3] ^ 0x6a6a6a6a;
|
||||
|
||||
opad[0] = SHA1M_A;
|
||||
opad[1] = SHA1M_B;
|
||||
opad[2] = SHA1M_C;
|
||||
opad[3] = SHA1M_D;
|
||||
opad[4] = SHA1M_E;
|
||||
|
||||
sha1_transform (w0, w1, w2, w3, opad);
|
||||
}
|
||||
|
||||
void hmac_sha1_run (u32 w0[4], u32 w1[4], u32 w2[4], u32 w3[4], u32 ipad[5], u32 opad[5], u32 digest[5])
|
||||
{
|
||||
digest[0] = ipad[0];
|
||||
digest[1] = ipad[1];
|
||||
digest[2] = ipad[2];
|
||||
digest[3] = ipad[3];
|
||||
digest[4] = ipad[4];
|
||||
|
||||
sha1_transform (w0, w1, w2, w3, digest);
|
||||
|
||||
w0[0] = digest[0];
|
||||
w0[1] = digest[1];
|
||||
w0[2] = digest[2];
|
||||
w0[3] = digest[3];
|
||||
w1[0] = digest[4];
|
||||
w1[1] = 0x80000000;
|
||||
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] = (64 + 20) * 8;
|
||||
|
||||
digest[0] = opad[0];
|
||||
digest[1] = opad[1];
|
||||
digest[2] = opad[2];
|
||||
digest[3] = opad[3];
|
||||
digest[4] = opad[4];
|
||||
|
||||
sha1_transform (w0, w1, w2, w3, digest);
|
||||
}
|
||||
|
||||
__kernel void m13600_init (__global pw_t *pws, __global kernel_rule_t *rules_buf, __global comb_t *combs_buf, __global bf_t *bfs_buf, __global pbkdf2_sha1_tmp_t *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 zip2_t *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)
|
||||
{
|
||||
/**
|
||||
* base
|
||||
*/
|
||||
|
||||
const u32 gid = get_global_id (0);
|
||||
|
||||
if (gid >= gid_max) return;
|
||||
|
||||
u32 w0[4];
|
||||
|
||||
w0[0] = swap32 (pws[gid].i[ 0]);
|
||||
w0[1] = swap32 (pws[gid].i[ 1]);
|
||||
w0[2] = swap32 (pws[gid].i[ 2]);
|
||||
w0[3] = swap32 (pws[gid].i[ 3]);
|
||||
|
||||
u32 w1[4];
|
||||
|
||||
w1[0] = swap32 (pws[gid].i[ 4]);
|
||||
w1[1] = swap32 (pws[gid].i[ 5]);
|
||||
w1[2] = swap32 (pws[gid].i[ 6]);
|
||||
w1[3] = swap32 (pws[gid].i[ 7]);
|
||||
|
||||
u32 w2[4];
|
||||
|
||||
w2[0] = swap32 (pws[gid].i[ 8]);
|
||||
w2[1] = swap32 (pws[gid].i[ 9]);
|
||||
w2[2] = swap32 (pws[gid].i[10]);
|
||||
w2[3] = swap32 (pws[gid].i[11]);
|
||||
|
||||
u32 w3[4];
|
||||
|
||||
w3[0] = swap32 (pws[gid].i[12]);
|
||||
w3[1] = swap32 (pws[gid].i[13]);
|
||||
w3[2] = swap32 (pws[gid].i[14]);
|
||||
w3[3] = swap32 (pws[gid].i[15]);
|
||||
|
||||
/**
|
||||
* salt
|
||||
*/
|
||||
|
||||
const u32 salt_len = esalt_bufs[salt_pos].salt_len;
|
||||
|
||||
u32 ipad[5];
|
||||
u32 opad[5];
|
||||
|
||||
hmac_sha1_pad (w0, w1, w2, w3, ipad, opad);
|
||||
|
||||
tmps[gid].ipad[0] = ipad[0];
|
||||
tmps[gid].ipad[1] = ipad[1];
|
||||
tmps[gid].ipad[2] = ipad[2];
|
||||
tmps[gid].ipad[3] = ipad[3];
|
||||
tmps[gid].ipad[4] = ipad[4];
|
||||
|
||||
tmps[gid].opad[0] = opad[0];
|
||||
tmps[gid].opad[1] = opad[1];
|
||||
tmps[gid].opad[2] = opad[2];
|
||||
tmps[gid].opad[3] = opad[3];
|
||||
tmps[gid].opad[4] = opad[4];
|
||||
|
||||
const u32 mode = esalt_bufs[salt_pos].mode;
|
||||
|
||||
u32 iter_start;
|
||||
u32 iter_stop;
|
||||
u32 count_start;
|
||||
|
||||
switch (mode)
|
||||
{
|
||||
case 1: iter_start = 0;
|
||||
iter_stop = 2;
|
||||
count_start = 1;
|
||||
break;
|
||||
case 2: iter_start = 1;
|
||||
iter_stop = 3;
|
||||
count_start = 2;
|
||||
break;
|
||||
case 3: iter_start = 1;
|
||||
iter_stop = 4;
|
||||
count_start = 2;
|
||||
break;
|
||||
}
|
||||
|
||||
for (u32 i = iter_start, j = count_start; i < iter_stop; i++, j++)
|
||||
{
|
||||
const u32 i5 = i * 5;
|
||||
|
||||
u32 esalt_buf[16];
|
||||
|
||||
esalt_buf[ 0] = swap32 (esalt_bufs[salt_pos].salt_buf[0]);
|
||||
esalt_buf[ 1] = swap32 (esalt_bufs[salt_pos].salt_buf[1]);
|
||||
esalt_buf[ 2] = swap32 (esalt_bufs[salt_pos].salt_buf[2]);
|
||||
esalt_buf[ 3] = swap32 (esalt_bufs[salt_pos].salt_buf[3]);
|
||||
esalt_buf[ 4] = 0;
|
||||
esalt_buf[ 5] = 0;
|
||||
esalt_buf[ 6] = 0;
|
||||
esalt_buf[ 7] = 0;
|
||||
esalt_buf[ 8] = 0;
|
||||
esalt_buf[ 9] = 0;
|
||||
esalt_buf[10] = 0;
|
||||
esalt_buf[11] = 0;
|
||||
esalt_buf[12] = 0;
|
||||
esalt_buf[13] = 0;
|
||||
esalt_buf[14] = 0;
|
||||
esalt_buf[15] = (64 + salt_len + 4) * 8;
|
||||
|
||||
switch (mode)
|
||||
{
|
||||
case 1: esalt_buf[2] = j;
|
||||
esalt_buf[3] = 0x80000000;
|
||||
break;
|
||||
case 2: esalt_buf[3] = j;
|
||||
esalt_buf[4] = 0x80000000;
|
||||
break;
|
||||
case 3: esalt_buf[4] = j;
|
||||
esalt_buf[5] = 0x80000000;
|
||||
break;
|
||||
}
|
||||
|
||||
u32 dgst[5];
|
||||
|
||||
hmac_sha1_run (esalt_buf + 0, esalt_buf + 4, esalt_buf + 8, esalt_buf + 12, ipad, opad, dgst);
|
||||
|
||||
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];
|
||||
|
||||
tmps[gid].out[i5 + 0] = dgst[0];
|
||||
tmps[gid].out[i5 + 1] = dgst[1];
|
||||
tmps[gid].out[i5 + 2] = dgst[2];
|
||||
tmps[gid].out[i5 + 3] = dgst[3];
|
||||
tmps[gid].out[i5 + 4] = dgst[4];
|
||||
}
|
||||
}
|
||||
|
||||
__kernel void m13600_loop (__global pw_t *pws, __global kernel_rule_t *rules_buf, __global comb_t *combs_buf, __global bf_t *bfs_buf, __global pbkdf2_sha1_tmp_t *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 zip2_t *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)
|
||||
{
|
||||
const u32 gid = get_global_id (0);
|
||||
|
||||
if (gid >= gid_max) return;
|
||||
|
||||
u32 ipad[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];
|
||||
|
||||
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];
|
||||
|
||||
const u32 mode = esalt_bufs[salt_pos].mode;
|
||||
|
||||
u32 iter_start;
|
||||
u32 iter_stop;
|
||||
u32 count_start;
|
||||
|
||||
switch (mode)
|
||||
{
|
||||
case 1: iter_start = 0;
|
||||
iter_stop = 2;
|
||||
count_start = 1;
|
||||
break;
|
||||
case 2: iter_start = 1;
|
||||
iter_stop = 3;
|
||||
count_start = 2;
|
||||
break;
|
||||
case 3: iter_start = 1;
|
||||
iter_stop = 4;
|
||||
count_start = 2;
|
||||
break;
|
||||
}
|
||||
|
||||
for (u32 i = iter_start, j = count_start; i < iter_stop; i++, j++)
|
||||
{
|
||||
const u32 i5 = i * 5;
|
||||
|
||||
u32 dgst[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];
|
||||
|
||||
u32 out[5];
|
||||
|
||||
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++)
|
||||
{
|
||||
u32 w0[4];
|
||||
u32 w1[4];
|
||||
u32 w2[4];
|
||||
u32 w3[4];
|
||||
|
||||
w0[0] = dgst[0];
|
||||
w0[1] = dgst[1];
|
||||
w0[2] = dgst[2];
|
||||
w0[3] = dgst[3];
|
||||
w1[0] = dgst[4];
|
||||
w1[1] = 0x80000000;
|
||||
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] = (64 + 20) * 8;
|
||||
|
||||
hmac_sha1_run (w0, w1, w2, w3, ipad, opad, dgst);
|
||||
|
||||
out[0] ^= dgst[0];
|
||||
out[1] ^= dgst[1];
|
||||
out[2] ^= dgst[2];
|
||||
out[3] ^= dgst[3];
|
||||
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];
|
||||
|
||||
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];
|
||||
}
|
||||
}
|
||||
|
||||
__kernel void m13600_comp (__global pw_t *pws, __global kernel_rule_t *rules_buf, __global comb_t *combs_buf, __global bf_t *bfs_buf, __global pbkdf2_sha1_tmp_t *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 zip2_t *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)
|
||||
{
|
||||
/**
|
||||
* base
|
||||
*/
|
||||
|
||||
const u32 gid = get_global_id (0);
|
||||
|
||||
if (gid >= gid_max) return;
|
||||
|
||||
const u32 lid = get_local_id (0);
|
||||
|
||||
u32 key[8] = { 0 };
|
||||
|
||||
const u32 mode = esalt_bufs[salt_pos].mode;
|
||||
|
||||
u32 iter_start;
|
||||
u32 iter_stop;
|
||||
|
||||
switch (mode)
|
||||
{
|
||||
case 1: iter_start = 4;
|
||||
iter_stop = 8;
|
||||
break;
|
||||
case 2: iter_start = 6;
|
||||
iter_stop = 12;
|
||||
break;
|
||||
case 3: iter_start = 8;
|
||||
iter_stop = 16;
|
||||
break;
|
||||
}
|
||||
|
||||
for (int i = iter_start, j = 0; i < iter_stop; i++, j++)
|
||||
{
|
||||
key[j] = tmps[gid].out[i];
|
||||
}
|
||||
|
||||
u32 w0[4];
|
||||
u32 w1[4];
|
||||
u32 w2[4];
|
||||
u32 w3[4];
|
||||
|
||||
w0[0] = key[0];
|
||||
w0[1] = key[1];
|
||||
w0[2] = key[2];
|
||||
w0[3] = key[3];
|
||||
w1[0] = key[4];
|
||||
w1[1] = key[5];
|
||||
w1[2] = key[6];
|
||||
w1[3] = key[7];
|
||||
w2[0] = 0;
|
||||
w2[1] = 0;
|
||||
w2[2] = 0;
|
||||
w2[3] = 0;
|
||||
w3[0] = 0;
|
||||
w3[1] = 0;
|
||||
w3[2] = 0;
|
||||
w3[3] = 0;
|
||||
|
||||
u32 ipad[5];
|
||||
u32 opad[5];
|
||||
|
||||
hmac_sha1_pad (w0, w1, w2, w3, ipad, opad);
|
||||
|
||||
int data_len = esalt_bufs[salt_pos].data_len;
|
||||
|
||||
int data_left;
|
||||
int data_off;
|
||||
|
||||
for (data_left = data_len, data_off = 0; data_left >= 56; data_left -= 64, data_off += 16)
|
||||
{
|
||||
w0[0] = swap32 (esalt_bufs[salt_pos].data_buf[data_off + 0]);
|
||||
w0[1] = swap32 (esalt_bufs[salt_pos].data_buf[data_off + 1]);
|
||||
w0[2] = swap32 (esalt_bufs[salt_pos].data_buf[data_off + 2]);
|
||||
w0[3] = swap32 (esalt_bufs[salt_pos].data_buf[data_off + 3]);
|
||||
w1[0] = swap32 (esalt_bufs[salt_pos].data_buf[data_off + 4]);
|
||||
w1[1] = swap32 (esalt_bufs[salt_pos].data_buf[data_off + 5]);
|
||||
w1[2] = swap32 (esalt_bufs[salt_pos].data_buf[data_off + 6]);
|
||||
w1[3] = swap32 (esalt_bufs[salt_pos].data_buf[data_off + 7]);
|
||||
w2[0] = swap32 (esalt_bufs[salt_pos].data_buf[data_off + 8]);
|
||||
w2[1] = swap32 (esalt_bufs[salt_pos].data_buf[data_off + 9]);
|
||||
w2[2] = swap32 (esalt_bufs[salt_pos].data_buf[data_off + 10]);
|
||||
w2[3] = swap32 (esalt_bufs[salt_pos].data_buf[data_off + 11]);
|
||||
w3[0] = swap32 (esalt_bufs[salt_pos].data_buf[data_off + 12]);
|
||||
w3[1] = swap32 (esalt_bufs[salt_pos].data_buf[data_off + 13]);
|
||||
w3[2] = swap32 (esalt_bufs[salt_pos].data_buf[data_off + 14]);
|
||||
w3[3] = swap32 (esalt_bufs[salt_pos].data_buf[data_off + 15]);
|
||||
|
||||
sha1_transform (w0, w1, w2, w3, ipad);
|
||||
}
|
||||
|
||||
w0[0] = swap32 (esalt_bufs[salt_pos].data_buf[data_off + 0]);
|
||||
w0[1] = swap32 (esalt_bufs[salt_pos].data_buf[data_off + 1]);
|
||||
w0[2] = swap32 (esalt_bufs[salt_pos].data_buf[data_off + 2]);
|
||||
w0[3] = swap32 (esalt_bufs[salt_pos].data_buf[data_off + 3]);
|
||||
w1[0] = swap32 (esalt_bufs[salt_pos].data_buf[data_off + 4]);
|
||||
w1[1] = swap32 (esalt_bufs[salt_pos].data_buf[data_off + 5]);
|
||||
w1[2] = swap32 (esalt_bufs[salt_pos].data_buf[data_off + 6]);
|
||||
w1[3] = swap32 (esalt_bufs[salt_pos].data_buf[data_off + 7]);
|
||||
w2[0] = swap32 (esalt_bufs[salt_pos].data_buf[data_off + 8]);
|
||||
w2[1] = swap32 (esalt_bufs[salt_pos].data_buf[data_off + 9]);
|
||||
w2[2] = swap32 (esalt_bufs[salt_pos].data_buf[data_off + 10]);
|
||||
w2[3] = swap32 (esalt_bufs[salt_pos].data_buf[data_off + 11]);
|
||||
w3[0] = swap32 (esalt_bufs[salt_pos].data_buf[data_off + 12]);
|
||||
w3[1] = swap32 (esalt_bufs[salt_pos].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);
|
||||
|
||||
#define il_pos 0
|
||||
|
||||
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);
|
||||
|
||||
#include COMPARE_M
|
||||
}
|
@ -893,6 +893,22 @@ typedef struct
|
||||
|
||||
} pstoken_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
u32 type;
|
||||
u32 mode;
|
||||
u32 magic;
|
||||
u32 salt_len;
|
||||
u32 salt_buf[4];
|
||||
u32 verify_bytes;
|
||||
u32 compress_length;
|
||||
u32 data_len;
|
||||
u32 data_buf[2048];
|
||||
u32 auth_len;
|
||||
u32 auth_buf[5];
|
||||
|
||||
} zip2_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
u32 version;
|
||||
|
@ -40,6 +40,7 @@ It combines all features of all hashcat projects in one project.
|
||||
- Added new hash-mode 13300 = AxCrypt in memory SHA1
|
||||
- Added new hash-mode 13400 = Keepass 1 (AES/Twofish) and Keepass 2 (AES)
|
||||
- Added new hash-mode 13500 = PeopleSoft PS_TOKEN
|
||||
- Added new hash-mode 13600 = WinZip
|
||||
|
||||
##
|
||||
## Performance
|
||||
|
@ -172,6 +172,7 @@ NVidia users require NVidia drivers 346.59 or later (recommended 361.x or later)
|
||||
- PeopleSoft
|
||||
- PeopleSoft PS_TOKEN
|
||||
- Skype
|
||||
- WinZip
|
||||
- 7-Zip
|
||||
- RAR3-hp
|
||||
- RAR5
|
||||
|
@ -356,6 +356,7 @@ extern hc_thread_mutex_t mux_display;
|
||||
#define HT_13300 "AxCrypt in memory SHA1"
|
||||
#define HT_13400 "Keepass 1 (AES/Twofish) and Keepass 2 (AES)"
|
||||
#define HT_13500 "PeopleSoft PS_TOKEN"
|
||||
#define HT_13600 "WinZip"
|
||||
|
||||
#define HT_00011 "Joomla < 2.5.18"
|
||||
#define HT_00012 "PostgreSQL"
|
||||
@ -700,6 +701,8 @@ extern hc_thread_mutex_t mux_display;
|
||||
#define DISPLAY_LEN_MAX_13400 1 + 7 + 1 + 1 + 10 + 1 + 3 + 1 + 64 + 1 + 64 + 1 + 32 + 1 + 64 + 1 + 4 + 1 + 600000 + 1 + 2 + 1 + 64
|
||||
#define DISPLAY_LEN_MIN_13500 40 + 1 + 32
|
||||
#define DISPLAY_LEN_MAX_13500 40 + 1 + 1024
|
||||
#define DISPLAY_LEN_MIN_13600 6 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 16 + 1 + 4 + 1 + 1 + 1 + 2 + 1 + 20 + 1 + 7
|
||||
#define DISPLAY_LEN_MAX_13600 6 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 32 + 1 + 4 + 1 + 4 + 1 + 8192 + 1 + 20 + 1 + 7
|
||||
|
||||
#define DISPLAY_LEN_MIN_11 32 + 1 + 16
|
||||
#define DISPLAY_LEN_MAX_11 32 + 1 + 32
|
||||
@ -966,6 +969,7 @@ extern hc_thread_mutex_t mux_display;
|
||||
#define KERN_TYPE_SHA1_AXCRYPT 13300
|
||||
#define KERN_TYPE_KEEPASS 13400
|
||||
#define KERN_TYPE_PSTOKEN 13500
|
||||
#define KERN_TYPE_ZIP2 13600
|
||||
|
||||
/**
|
||||
* signatures
|
||||
@ -1037,8 +1041,10 @@ extern hc_thread_mutex_t mux_display;
|
||||
#define SIGNATURE_RAR5 "$rar5$"
|
||||
#define SIGNATURE_KRB5TGS "$krb5tgs$23"
|
||||
#define SIGNATURE_AXCRYPT "$axcrypt$*1"
|
||||
#define SIGNATURE_AXCRYPT_SHA1 "$axcrypt_sha1"
|
||||
#define SIGNATURE_AXCRYPT_SHA1 "$axcrypt_sha1"
|
||||
#define SIGNATURE_KEEPASS "$keepass$"
|
||||
#define SIGNATURE_ZIP2_START "$zip2$"
|
||||
#define SIGNATURE_ZIP2_STOP "$/zip2$"
|
||||
|
||||
/**
|
||||
* Default iteration numbers
|
||||
@ -1092,6 +1098,7 @@ extern hc_thread_mutex_t mux_display;
|
||||
#define ROUNDS_RAR5 (1 << 15)
|
||||
#define ROUNDS_AXCRYPT 10000
|
||||
#define ROUNDS_KEEPASS 6000
|
||||
#define ROUNDS_ZIP2 1000
|
||||
|
||||
/**
|
||||
* salt types
|
||||
@ -1608,6 +1615,7 @@ int axcrypt_parse_hash (char *input_buf, uint input_len, hash_t *hash
|
||||
int sha1axcrypt_parse_hash (char *input_buf, uint input_len, hash_t *hash_buf);
|
||||
int keepass_parse_hash (char *input_buf, uint input_len, hash_t *hash_buf);
|
||||
int pstoken_parse_hash (char *input_buf, uint input_len, hash_t *hash_buf);
|
||||
int zip2_parse_hash (char *input_buf, uint input_len, hash_t *hash_buf);
|
||||
|
||||
void load_kernel (const char *kernel_file, int num_devices, size_t *kernel_lengths, const u8 **kernel_sources);
|
||||
void writeProgramBin (char *dst, u8 *binary, size_t binary_size);
|
||||
|
@ -266,6 +266,22 @@ typedef struct
|
||||
|
||||
} pstoken_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
u32 type;
|
||||
u32 mode;
|
||||
u32 magic;
|
||||
u32 salt_len;
|
||||
u32 salt_buf[4];
|
||||
u32 verify_bytes;
|
||||
u32 compress_length;
|
||||
u32 data_len;
|
||||
u32 data_buf[2048];
|
||||
u32 auth_len;
|
||||
u32 auth_buf[5];
|
||||
|
||||
} zip2_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint P[256];
|
||||
|
@ -148,7 +148,7 @@ double TARGET_MS_PROFILE[3] = { 8, 16, 96 };
|
||||
|
||||
#define MAX_DICTSTAT 10000
|
||||
|
||||
#define NUM_DEFAULT_BENCHMARK_ALGORITHMS 136
|
||||
#define NUM_DEFAULT_BENCHMARK_ALGORITHMS 137
|
||||
|
||||
#define global_free(attr) \
|
||||
{ \
|
||||
@ -270,6 +270,7 @@ static uint default_benchmark_algorithms[NUM_DEFAULT_BENCHMARK_ALGORITHMS] =
|
||||
133,
|
||||
13500,
|
||||
11600,
|
||||
13600,
|
||||
12500,
|
||||
13000,
|
||||
13200,
|
||||
@ -706,6 +707,7 @@ const char *USAGE_BIG[] =
|
||||
" 13000 = RAR5",
|
||||
" 13200 = AxCrypt",
|
||||
" 13300 = AxCrypt in memory SHA1",
|
||||
" 13600 = WinZip",
|
||||
"",
|
||||
"[[ Full-Disk encryptions (FDE) ]]",
|
||||
"",
|
||||
@ -2914,32 +2916,24 @@ static void autotune (hc_device_param_t *device_param)
|
||||
}
|
||||
}
|
||||
|
||||
// sometimes we're in a bad situation that the algorithm is so slow that we can not
|
||||
// create enough kernel_accel to do both, keep the gpu busy and stay below target_ms.
|
||||
// however, we need to have a minimum kernel_accel and kernel_loops of 32.
|
||||
// luckily, at this level of workload, it became a linear function
|
||||
// balancing the workload turns out to be very efficient
|
||||
|
||||
if (kernel_accel < 32 || kernel_loops < 32)
|
||||
const u32 kernel_power_balance = kernel_accel * kernel_loops;
|
||||
|
||||
u32 sqrtv;
|
||||
|
||||
for (sqrtv = 1; sqrtv < 0x100000; sqrtv++)
|
||||
{
|
||||
const u32 kernel_power = kernel_accel * kernel_loops;
|
||||
if ((sqrtv * sqrtv) >= kernel_power_balance) break;
|
||||
}
|
||||
|
||||
// find sqrt
|
||||
const u32 kernel_accel_try = sqrtv;
|
||||
const u32 kernel_loops_try = sqrtv;
|
||||
|
||||
u32 sqrtv;
|
||||
|
||||
for (sqrtv = 1; sqrtv < 0x100000; sqrtv++)
|
||||
{
|
||||
if ((sqrtv * sqrtv) >= kernel_power) break;
|
||||
}
|
||||
|
||||
const u32 kernel_accel_try = sqrtv;
|
||||
const u32 kernel_loops_try = sqrtv;
|
||||
|
||||
if ((kernel_accel_try <= kernel_accel_max) && (kernel_loops_try >= kernel_loops_min))
|
||||
{
|
||||
kernel_accel = kernel_accel_try;
|
||||
kernel_loops = kernel_loops_try;
|
||||
}
|
||||
if ((kernel_accel_try <= kernel_accel_max) && (kernel_loops_try >= kernel_loops_min))
|
||||
{
|
||||
kernel_accel = kernel_accel_try;
|
||||
kernel_loops = kernel_loops_try;
|
||||
}
|
||||
|
||||
// reset fake words
|
||||
@ -5881,7 +5875,7 @@ int main (int argc, char **argv)
|
||||
return (-1);
|
||||
}
|
||||
|
||||
if (hash_mode_chgd && hash_mode > 13500) // just added to remove compiler warnings for hash_mode_chgd
|
||||
if (hash_mode_chgd && hash_mode > 13600) // just added to remove compiler warnings for hash_mode_chgd
|
||||
{
|
||||
log_error ("ERROR: Invalid hash-type specified");
|
||||
|
||||
@ -10228,6 +10222,21 @@ int main (int argc, char **argv)
|
||||
dgst_pos3 = 1;
|
||||
break;
|
||||
|
||||
case 13600: hash_type = HASH_TYPE_PBKDF2_SHA1;
|
||||
salt_type = SALT_TYPE_EMBEDDED;
|
||||
attack_exec = ATTACK_EXEC_OUTSIDE_KERNEL;
|
||||
opts_type = OPTS_TYPE_PT_GENERATE_LE;
|
||||
kern_type = KERN_TYPE_ZIP2;
|
||||
dgst_size = DGST_SIZE_4_5;
|
||||
parse_func = zip2_parse_hash;
|
||||
sort_by_digest = sort_by_digest_4_5;
|
||||
opti_type = OPTI_TYPE_ZERO_BYTE;
|
||||
dgst_pos0 = 0;
|
||||
dgst_pos1 = 1;
|
||||
dgst_pos2 = 2;
|
||||
dgst_pos3 = 3;
|
||||
break;
|
||||
|
||||
default: usage_mini_print (PROGNAME); return (-1);
|
||||
}
|
||||
|
||||
@ -10334,6 +10343,7 @@ int main (int argc, char **argv)
|
||||
case 13100: esalt_size = sizeof (krb5tgs_t); break;
|
||||
case 13400: esalt_size = sizeof (keepass_t); break;
|
||||
case 13500: esalt_size = sizeof (pstoken_t); break;
|
||||
case 13600: esalt_size = sizeof (zip2_t); break;
|
||||
}
|
||||
|
||||
data.esalt_size = esalt_size;
|
||||
@ -11439,9 +11449,13 @@ int main (int argc, char **argv)
|
||||
((seven_zip_t *) hashes_buf[0].esalt)->data_len = 112;
|
||||
((seven_zip_t *) hashes_buf[0].esalt)->unpack_size = 112;
|
||||
break;
|
||||
case 13400: ((keepass_t *) hashes_buf[0].esalt)->version = 2;
|
||||
case 13400: ((keepass_t *) hashes_buf[0].esalt)->version = 2;
|
||||
break;
|
||||
case 13500: ((pstoken_t *) hashes_buf[0].esalt)->salt_len = 113;
|
||||
case 13500: ((pstoken_t *) hashes_buf[0].esalt)->salt_len = 113;
|
||||
break;
|
||||
case 13600: ((zip2_t *) hashes_buf[0].esalt)->salt_len = 16;
|
||||
((zip2_t *) hashes_buf[0].esalt)->data_len = 32;
|
||||
((zip2_t *) hashes_buf[0].esalt)->mode = 3;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -11618,6 +11632,8 @@ int main (int argc, char **argv)
|
||||
break;
|
||||
case 13400: hashes_buf[0].salt->salt_iter = ROUNDS_KEEPASS;
|
||||
break;
|
||||
case 13600: hashes_buf[0].salt->salt_iter = ROUNDS_ZIP2;
|
||||
break;
|
||||
}
|
||||
|
||||
hashes_cnt = 1;
|
||||
@ -13891,6 +13907,7 @@ int main (int argc, char **argv)
|
||||
case 13000: size_tmps = kernel_power_max * sizeof (pbkdf2_sha256_tmp_t); break;
|
||||
case 13200: size_tmps = kernel_power_max * sizeof (axcrypt_tmp_t); break;
|
||||
case 13400: size_tmps = kernel_power_max * sizeof (keepass_tmp_t); break;
|
||||
case 13600: size_tmps = kernel_power_max * sizeof (pbkdf2_sha1_tmp_t); break;
|
||||
};
|
||||
|
||||
// size_hooks
|
||||
|
281
src/shared.c
281
src/shared.c
@ -5856,6 +5856,7 @@ char *strhashtype (const uint hash_mode)
|
||||
case 13300: return ((char *) HT_13300); break;
|
||||
case 13400: return ((char *) HT_13400); break;
|
||||
case 13500: return ((char *) HT_13500); break;
|
||||
case 13600: return ((char *) HT_13600); break;
|
||||
}
|
||||
|
||||
return ((char *) "Unknown");
|
||||
@ -8507,6 +8508,57 @@ void ascii_digest (char *out_buf, uint salt_pos, uint digest_pos)
|
||||
digest_buf[4],
|
||||
pstoken_tmp);
|
||||
}
|
||||
else if (hash_mode == 13600)
|
||||
{
|
||||
zip2_t *zip2s = (zip2_t *) data.esalts_buf;
|
||||
|
||||
zip2_t *zip2 = &zip2s[salt_pos];
|
||||
|
||||
const u32 salt_len = zip2->salt_len;
|
||||
|
||||
char salt_tmp[32 + 1] = { 0 };
|
||||
|
||||
for (uint i = 0, j = 0; i < salt_len; i += 1, j += 2)
|
||||
{
|
||||
const u8 *ptr = (const u8 *) zip2->salt_buf;
|
||||
|
||||
sprintf (salt_tmp + j, "%02x", ptr[i]);
|
||||
}
|
||||
|
||||
const u32 data_len = zip2->data_len;
|
||||
|
||||
char data_tmp[8192 + 1] = { 0 };
|
||||
|
||||
for (uint i = 0, j = 0; i < data_len; i += 1, j += 2)
|
||||
{
|
||||
const u8 *ptr = (const u8 *) zip2->data_buf;
|
||||
|
||||
sprintf (data_tmp + j, "%02x", ptr[i]);
|
||||
}
|
||||
|
||||
const u32 auth_len = zip2->auth_len;
|
||||
|
||||
char auth_tmp[20 + 1] = { 0 };
|
||||
|
||||
for (uint i = 0, j = 0; i < auth_len; i += 1, j += 2)
|
||||
{
|
||||
const u8 *ptr = (const u8 *) zip2->auth_buf;
|
||||
|
||||
sprintf (auth_tmp + j, "%02x", ptr[i]);
|
||||
}
|
||||
|
||||
snprintf (out_buf, 255, "%s*%u*%u*%u*%s*%4x*%u*%s*%s*%s",
|
||||
SIGNATURE_ZIP2_START,
|
||||
zip2->type,
|
||||
zip2->mode,
|
||||
zip2->magic,
|
||||
salt_tmp,
|
||||
zip2->verify_bytes,
|
||||
zip2->compress_length,
|
||||
data_tmp,
|
||||
auth_tmp,
|
||||
SIGNATURE_ZIP2_STOP);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (hash_type == HASH_TYPE_MD4)
|
||||
@ -19860,6 +19912,235 @@ int androidfde_samsung_parse_hash (char *input_buf, uint input_len, hash_t *hash
|
||||
return (PARSER_OK);
|
||||
}
|
||||
|
||||
int zip2_parse_hash (char *input_buf, uint input_len, hash_t *hash_buf)
|
||||
{
|
||||
if ((input_len < DISPLAY_LEN_MIN_13600) || (input_len > DISPLAY_LEN_MAX_13600)) return (PARSER_GLOBAL_LENGTH);
|
||||
|
||||
if (memcmp (SIGNATURE_ZIP2_START, input_buf , 6)) return (PARSER_SIGNATURE_UNMATCHED);
|
||||
if (memcmp (SIGNATURE_ZIP2_STOP , input_buf + input_len - 7, 7)) return (PARSER_SIGNATURE_UNMATCHED);
|
||||
|
||||
u32 *digest = (u32 *) hash_buf->digest;
|
||||
|
||||
salt_t *salt = hash_buf->salt;
|
||||
|
||||
zip2_t *zip2 = (zip2_t *) hash_buf->esalt;
|
||||
|
||||
/**
|
||||
* parse line
|
||||
*/
|
||||
|
||||
char *param0_pos = input_buf + 6 + 1;
|
||||
|
||||
char *param1_pos = strchr (param0_pos, '*');
|
||||
|
||||
if (param1_pos == NULL) return (PARSER_SEPARATOR_UNMATCHED);
|
||||
|
||||
u32 param0_len = param1_pos - param0_pos;
|
||||
|
||||
param1_pos++;
|
||||
|
||||
char *param2_pos = strchr (param1_pos, '*');
|
||||
|
||||
if (param2_pos == NULL) return (PARSER_SEPARATOR_UNMATCHED);
|
||||
|
||||
u32 param1_len = param2_pos - param1_pos;
|
||||
|
||||
param2_pos++;
|
||||
|
||||
char *param3_pos = strchr (param2_pos, '*');
|
||||
|
||||
if (param3_pos == NULL) return (PARSER_SEPARATOR_UNMATCHED);
|
||||
|
||||
u32 param2_len = param3_pos - param2_pos;
|
||||
|
||||
param3_pos++;
|
||||
|
||||
char *param4_pos = strchr (param3_pos, '*');
|
||||
|
||||
if (param4_pos == NULL) return (PARSER_SEPARATOR_UNMATCHED);
|
||||
|
||||
u32 param3_len = param4_pos - param3_pos;
|
||||
|
||||
param4_pos++;
|
||||
|
||||
char *param5_pos = strchr (param4_pos, '*');
|
||||
|
||||
if (param5_pos == NULL) return (PARSER_SEPARATOR_UNMATCHED);
|
||||
|
||||
u32 param4_len = param5_pos - param4_pos;
|
||||
|
||||
param5_pos++;
|
||||
|
||||
char *param6_pos = strchr (param5_pos, '*');
|
||||
|
||||
if (param6_pos == NULL) return (PARSER_SEPARATOR_UNMATCHED);
|
||||
|
||||
u32 param5_len = param6_pos - param5_pos;
|
||||
|
||||
param6_pos++;
|
||||
|
||||
char *param7_pos = strchr (param6_pos, '*');
|
||||
|
||||
if (param7_pos == NULL) return (PARSER_SEPARATOR_UNMATCHED);
|
||||
|
||||
u32 param6_len = param7_pos - param6_pos;
|
||||
|
||||
param7_pos++;
|
||||
|
||||
char *param8_pos = strchr (param7_pos, '*');
|
||||
|
||||
if (param8_pos == NULL) return (PARSER_SEPARATOR_UNMATCHED);
|
||||
|
||||
u32 param7_len = param8_pos - param7_pos;
|
||||
|
||||
param8_pos++;
|
||||
|
||||
const uint type = atoi (param0_pos);
|
||||
const uint mode = atoi (param1_pos);
|
||||
const uint magic = atoi (param2_pos);
|
||||
|
||||
char *salt_buf = param3_pos;
|
||||
|
||||
uint verify_bytes; sscanf (param4_pos, "%4x*", &verify_bytes);
|
||||
|
||||
const uint compress_length = atoi (param5_pos);
|
||||
|
||||
char *data_buf = param6_pos;
|
||||
char *auth = param7_pos;
|
||||
|
||||
/**
|
||||
* verify some data
|
||||
*/
|
||||
|
||||
if (param0_len != 1) return (PARSER_SALT_VALUE);
|
||||
|
||||
if (param1_len != 1) return (PARSER_SALT_VALUE);
|
||||
|
||||
if (param2_len != 1) return (PARSER_SALT_VALUE);
|
||||
|
||||
if ((param3_len != 16) && (param3_len != 24) && (param3_len != 32)) return (PARSER_SALT_VALUE);
|
||||
|
||||
if (param4_len >= 5) return (PARSER_SALT_VALUE);
|
||||
|
||||
if (param5_len >= 5) return (PARSER_SALT_VALUE);
|
||||
|
||||
if (param6_len >= 8192) return (PARSER_SALT_VALUE);
|
||||
|
||||
if (param6_len & 1) return (PARSER_SALT_VALUE);
|
||||
|
||||
if (param7_len != 20) return (PARSER_SALT_VALUE);
|
||||
|
||||
if (type != 0) return (PARSER_SALT_VALUE);
|
||||
|
||||
if ((mode != 1) && (mode != 2) && (mode != 3)) return (PARSER_SALT_VALUE);
|
||||
|
||||
if (magic != 0) return (PARSER_SALT_VALUE);
|
||||
|
||||
if (verify_bytes >= 0x10000) return (PARSER_SALT_VALUE);
|
||||
|
||||
/**
|
||||
* store data
|
||||
*/
|
||||
|
||||
zip2->type = type;
|
||||
zip2->mode = mode;
|
||||
zip2->magic = magic;
|
||||
|
||||
if (mode == 1)
|
||||
{
|
||||
zip2->salt_buf[0] = hex_to_u32 ((const u8 *) &salt_buf[ 0]);
|
||||
zip2->salt_buf[1] = hex_to_u32 ((const u8 *) &salt_buf[ 8]);
|
||||
zip2->salt_buf[2] = 0;
|
||||
zip2->salt_buf[3] = 0;
|
||||
|
||||
zip2->salt_len = 8;
|
||||
}
|
||||
else if (mode == 2)
|
||||
{
|
||||
zip2->salt_buf[0] = hex_to_u32 ((const u8 *) &salt_buf[ 0]);
|
||||
zip2->salt_buf[1] = hex_to_u32 ((const u8 *) &salt_buf[ 8]);
|
||||
zip2->salt_buf[2] = hex_to_u32 ((const u8 *) &salt_buf[16]);
|
||||
zip2->salt_buf[3] = 0;
|
||||
|
||||
zip2->salt_len = 12;
|
||||
}
|
||||
else if (mode == 3)
|
||||
{
|
||||
zip2->salt_buf[0] = hex_to_u32 ((const u8 *) &salt_buf[ 0]);
|
||||
zip2->salt_buf[1] = hex_to_u32 ((const u8 *) &salt_buf[ 8]);
|
||||
zip2->salt_buf[2] = hex_to_u32 ((const u8 *) &salt_buf[16]);
|
||||
zip2->salt_buf[3] = hex_to_u32 ((const u8 *) &salt_buf[24]);
|
||||
|
||||
zip2->salt_len = 16;
|
||||
}
|
||||
|
||||
zip2->salt_buf[0] = byte_swap_32 (zip2->salt_buf[0]);
|
||||
zip2->salt_buf[1] = byte_swap_32 (zip2->salt_buf[1]);
|
||||
zip2->salt_buf[2] = byte_swap_32 (zip2->salt_buf[2]);
|
||||
zip2->salt_buf[3] = byte_swap_32 (zip2->salt_buf[3]);
|
||||
|
||||
zip2->verify_bytes = verify_bytes;
|
||||
|
||||
zip2->compress_length = compress_length;
|
||||
|
||||
char *data_buf_ptr = (char *) zip2->data_buf;
|
||||
|
||||
for (uint i = 0; i < param6_len; i += 2)
|
||||
{
|
||||
const char p0 = data_buf[i + 0];
|
||||
const char p1 = data_buf[i + 1];
|
||||
|
||||
*data_buf_ptr++ = hex_convert (p1) << 0
|
||||
| hex_convert (p0) << 4;
|
||||
|
||||
zip2->data_len++;
|
||||
}
|
||||
|
||||
*data_buf_ptr = 0x80;
|
||||
|
||||
char *auth_ptr = (char *) zip2->auth_buf;
|
||||
|
||||
for (uint i = 0; i < param7_len; i += 2)
|
||||
{
|
||||
const char p0 = auth[i + 0];
|
||||
const char p1 = auth[i + 1];
|
||||
|
||||
*auth_ptr++ = hex_convert (p1) << 0
|
||||
| hex_convert (p0) << 4;
|
||||
|
||||
zip2->auth_len++;
|
||||
}
|
||||
|
||||
/**
|
||||
* salt buf (fake)
|
||||
*/
|
||||
|
||||
salt->salt_buf[0] = zip2->salt_buf[0];
|
||||
salt->salt_buf[1] = zip2->salt_buf[1];
|
||||
salt->salt_buf[2] = zip2->salt_buf[2];
|
||||
salt->salt_buf[3] = zip2->salt_buf[3];
|
||||
salt->salt_buf[4] = zip2->data_buf[0];
|
||||
salt->salt_buf[5] = zip2->data_buf[1];
|
||||
salt->salt_buf[6] = zip2->data_buf[2];
|
||||
salt->salt_buf[7] = zip2->data_buf[3];
|
||||
|
||||
salt->salt_len = 32;
|
||||
|
||||
salt->salt_iter = ROUNDS_ZIP2 - 1;
|
||||
|
||||
/**
|
||||
* digest buf (fake)
|
||||
*/
|
||||
|
||||
digest[0] = zip2->auth_buf[0];
|
||||
digest[1] = zip2->auth_buf[1];
|
||||
digest[2] = zip2->auth_buf[2];
|
||||
digest[3] = zip2->auth_buf[3];
|
||||
digest[4] = zip2->auth_buf[4];
|
||||
|
||||
return (PARSER_OK);
|
||||
}
|
||||
|
||||
/**
|
||||
* parallel running threads
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user