Merge pull request #1809 from hashcat/master

Backports from master
pull/1832/head
Jens Steube 6 years ago committed by GitHub
commit c6dcb1b8ae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -236,6 +236,26 @@ DECLSPEC int is_valid_hex_32 (const u32 v)
return 1;
}
DECLSPEC int is_valid_base58_8 (const u8 v)
{
if (v > 'z') return 0;
if (v < '1') return 0;
if ((v > '9') && (v < 'A')) return 0;
if ((v > 'Z') && (v < 'a')) return 0;
return 1;
}
DECLSPEC int is_valid_base58_32 (const u32 v)
{
if (is_valid_base58_8 ((u8) (v >> 0)) == 0) return 0;
if (is_valid_base58_8 ((u8) (v >> 8)) == 0) return 0;
if (is_valid_base58_8 ((u8) (v >> 16)) == 0) return 0;
if (is_valid_base58_8 ((u8) (v >> 24)) == 0) return 0;
return 1;
}
DECLSPEC int find_keyboard_layout_map (const u32 search, const int search_len, __local keyboard_layout_mapping_t *s_keyboard_layout_mapping_buf, const int keyboard_layout_mapping_cnt)
{
for (int idx = 0; idx < keyboard_layout_mapping_cnt; idx++)

@ -1403,6 +1403,25 @@ typedef struct oldoffice34
} oldoffice34_t;
typedef struct odf12_tmp
{
u32 ipad[5];
u32 opad[5];
u32 dgst[10];
u32 out[10];
} odf12_tmp_t;
typedef struct odf12
{
u32 iterations;
u32 iv[4];
u32 checksum[8];
u32 encrypted_data[256];
} odf12_t;
typedef struct pstoken
{
u32 salt_buf[128];

@ -373,6 +373,22 @@ __kernel void m16600_m04 (KERN_ATTR_RULES_ESALT (electrum_wallet_t))
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos);
}
}
if (esalt_bufs[digests_offset].salt_type == 2)
{
if ((u8) (out[0] >> 0) != 'x') continue;
if ((u8) (out[0] >> 8) != 'p') continue;
if ((u8) (out[0] >> 16) != 'r') continue;
if ((u8) (out[0] >> 24) != 'v') continue;
if (is_valid_base58_32 (out[1]) == 0) continue;
if (is_valid_base58_32 (out[2]) == 0) continue;
if (is_valid_base58_32 (out[3]) == 0) continue;
if (atomic_inc (&hashes_shown[digests_offset]) == 0)
{
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos);
}
}
}
}
@ -742,6 +758,22 @@ __kernel void m16600_s04 (KERN_ATTR_RULES_ESALT (electrum_wallet_t))
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos);
}
}
if (esalt_bufs[digests_offset].salt_type == 2)
{
if ((u8) (out[0] >> 0) != 'x') continue;
if ((u8) (out[0] >> 8) != 'p') continue;
if ((u8) (out[0] >> 16) != 'r') continue;
if ((u8) (out[0] >> 24) != 'v') continue;
if (is_valid_base58_32 (out[1]) == 0) continue;
if (is_valid_base58_32 (out[2]) == 0) continue;
if (is_valid_base58_32 (out[3]) == 0) continue;
if (atomic_inc (&hashes_shown[digests_offset]) == 0)
{
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos);
}
}
}
}

@ -188,6 +188,22 @@ __kernel void m16600_mxx (KERN_ATTR_RULES_ESALT (electrum_wallet_t))
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos);
}
}
if (esalt_bufs[digests_offset].salt_type == 2)
{
if ((u8) (out[0] >> 0) != 'x') continue;
if ((u8) (out[0] >> 8) != 'p') continue;
if ((u8) (out[0] >> 16) != 'r') continue;
if ((u8) (out[0] >> 24) != 'v') continue;
if (is_valid_base58_32 (out[1]) == 0) continue;
if (is_valid_base58_32 (out[2]) == 0) continue;
if (is_valid_base58_32 (out[3]) == 0) continue;
if (atomic_inc (&hashes_shown[digests_offset]) == 0)
{
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos);
}
}
}
}
@ -363,5 +379,21 @@ __kernel void m16600_sxx (KERN_ATTR_RULES_ESALT (electrum_wallet_t))
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos);
}
}
if (esalt_bufs[digests_offset].salt_type == 2)
{
if ((u8) (out[0] >> 0) != 'x') continue;
if ((u8) (out[0] >> 8) != 'p') continue;
if ((u8) (out[0] >> 16) != 'r') continue;
if ((u8) (out[0] >> 24) != 'v') continue;
if (is_valid_base58_32 (out[1]) == 0) continue;
if (is_valid_base58_32 (out[2]) == 0) continue;
if (is_valid_base58_32 (out[3]) == 0) continue;
if (atomic_inc (&hashes_shown[digests_offset]) == 0)
{
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos);
}
}
}
}

@ -429,6 +429,22 @@ __kernel void m16600_m04 (KERN_ATTR_ESALT (electrum_wallet_t))
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos);
}
}
if (esalt_bufs[digests_offset].salt_type == 2)
{
if ((u8) (out[0] >> 0) != 'x') continue;
if ((u8) (out[0] >> 8) != 'p') continue;
if ((u8) (out[0] >> 16) != 'r') continue;
if ((u8) (out[0] >> 24) != 'v') continue;
if (is_valid_base58_32 (out[1]) == 0) continue;
if (is_valid_base58_32 (out[2]) == 0) continue;
if (is_valid_base58_32 (out[3]) == 0) continue;
if (atomic_inc (&hashes_shown[digests_offset]) == 0)
{
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos);
}
}
}
}
@ -856,6 +872,22 @@ __kernel void m16600_s04 (KERN_ATTR_ESALT (electrum_wallet_t))
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos);
}
}
if (esalt_bufs[digests_offset].salt_type == 2)
{
if ((u8) (out[0] >> 0) != 'x') continue;
if ((u8) (out[0] >> 8) != 'p') continue;
if ((u8) (out[0] >> 16) != 'r') continue;
if ((u8) (out[0] >> 24) != 'v') continue;
if (is_valid_base58_32 (out[1]) == 0) continue;
if (is_valid_base58_32 (out[2]) == 0) continue;
if (is_valid_base58_32 (out[3]) == 0) continue;
if (atomic_inc (&hashes_shown[digests_offset]) == 0)
{
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos);
}
}
}
}

@ -184,6 +184,22 @@ __kernel void m16600_mxx (KERN_ATTR_ESALT (electrum_wallet_t))
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos);
}
}
if (esalt_bufs[digests_offset].salt_type == 2)
{
if ((u8) (out[0] >> 0) != 'x') continue;
if ((u8) (out[0] >> 8) != 'p') continue;
if ((u8) (out[0] >> 16) != 'r') continue;
if ((u8) (out[0] >> 24) != 'v') continue;
if (is_valid_base58_32 (out[1]) == 0) continue;
if (is_valid_base58_32 (out[2]) == 0) continue;
if (is_valid_base58_32 (out[3]) == 0) continue;
if (atomic_inc (&hashes_shown[digests_offset]) == 0)
{
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos);
}
}
}
}
@ -357,5 +373,21 @@ __kernel void m16600_sxx (KERN_ATTR_ESALT (electrum_wallet_t))
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos);
}
}
if (esalt_bufs[digests_offset].salt_type == 2)
{
if ((u8) (out[0] >> 0) != 'x') continue;
if ((u8) (out[0] >> 8) != 'p') continue;
if ((u8) (out[0] >> 16) != 'r') continue;
if ((u8) (out[0] >> 24) != 'v') continue;
if (is_valid_base58_32 (out[1]) == 0) continue;
if (is_valid_base58_32 (out[2]) == 0) continue;
if (is_valid_base58_32 (out[3]) == 0) continue;
if (atomic_inc (&hashes_shown[digests_offset]) == 0)
{
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos);
}
}
}
}

@ -291,6 +291,22 @@ DECLSPEC void m16600 (SHM_TYPE u32a *s_te0, SHM_TYPE u32a *s_te1, SHM_TYPE u32a
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos);
}
}
if (esalt_bufs[digests_offset].salt_type == 2)
{
if ((u8) (out[0] >> 0) != 'x') continue;
if ((u8) (out[0] >> 8) != 'p') continue;
if ((u8) (out[0] >> 16) != 'r') continue;
if ((u8) (out[0] >> 24) != 'v') continue;
if (is_valid_base58_32 (out[1]) == 0) continue;
if (is_valid_base58_32 (out[2]) == 0) continue;
if (is_valid_base58_32 (out[3]) == 0) continue;
if (atomic_inc (&hashes_shown[digests_offset]) == 0)
{
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos);
}
}
}
}

@ -197,6 +197,22 @@ __kernel void m16600_mxx (KERN_ATTR_VECTOR_ESALT (electrum_wallet_t))
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos);
}
}
if (esalt_bufs[digests_offset].salt_type == 2)
{
if ((u8) (out[0] >> 0) != 'x') continue;
if ((u8) (out[0] >> 8) != 'p') continue;
if ((u8) (out[0] >> 16) != 'r') continue;
if ((u8) (out[0] >> 24) != 'v') continue;
if (is_valid_base58_32 (out[1]) == 0) continue;
if (is_valid_base58_32 (out[2]) == 0) continue;
if (is_valid_base58_32 (out[3]) == 0) continue;
if (atomic_inc (&hashes_shown[digests_offset]) == 0)
{
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos);
}
}
}
}
@ -383,5 +399,21 @@ __kernel void m16600_sxx (KERN_ATTR_VECTOR_ESALT (electrum_wallet_t))
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos);
}
}
if (esalt_bufs[digests_offset].salt_type == 2)
{
if ((u8) (out[0] >> 0) != 'x') continue;
if ((u8) (out[0] >> 8) != 'p') continue;
if ((u8) (out[0] >> 16) != 'r') continue;
if ((u8) (out[0] >> 24) != 'v') continue;
if (is_valid_base58_32 (out[1]) == 0) continue;
if (is_valid_base58_32 (out[2]) == 0) continue;
if (is_valid_base58_32 (out[3]) == 0) continue;
if (atomic_inc (&hashes_shown[digests_offset]) == 0)
{
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos);
}
}
}
}

@ -0,0 +1,452 @@
/**
* Author......: See docs/credits.txt
* License.....: MIT
*/
#define NEW_SIMD_CODE
#include "inc_vendor.cl"
#include "inc_hash_constants.h"
#include "inc_hash_functions.cl"
#include "inc_types.cl"
#include "inc_common.cl"
#include "inc_simd.cl"
#include "inc_hash_sha1.cl"
#include "inc_hash_sha256.cl"
#include "inc_cipher_aes.cl"
#define COMPARE_S "inc_comp_single.cl"
#define COMPARE_M "inc_comp_multi.cl"
DECLSPEC void hmac_sha1_run_V (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *ipad, u32x *opad, u32x *digest)
{
digest[0] = ipad[0];
digest[1] = ipad[1];
digest[2] = ipad[2];
digest[3] = ipad[3];
digest[4] = ipad[4];
sha1_transform_vector (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_vector (w0, w1, w2, w3, digest);
}
__kernel void m18400_init (KERN_ATTR_TMPS_ESALT (odf12_tmp_t, odf12_t))
{
/**
* base
*/
const u64 gid = get_global_id (0);
if (gid >= gid_max) return;
sha256_ctx_t sha256_ctx;
sha256_init (&sha256_ctx);
sha256_update_global_swap (&sha256_ctx, pws[gid].i, pws[gid].pw_len);
sha256_final (&sha256_ctx);
// hmac key = hashed passphrase
u32 k0[4];
u32 k1[4];
u32 k2[4];
u32 k3[4];
k0[0] = sha256_ctx.h[0];
k0[1] = sha256_ctx.h[1];
k0[2] = sha256_ctx.h[2];
k0[3] = sha256_ctx.h[3];
k1[0] = sha256_ctx.h[4];
k1[1] = sha256_ctx.h[5];
k1[2] = sha256_ctx.h[6];
k1[3] = sha256_ctx.h[7];
k2[0] = 0;
k2[1] = 0;
k2[2] = 0;
k2[3] = 0;
k3[0] = 0;
k3[1] = 0;
k3[2] = 0;
k3[3] = 0;
// hmac message = salt
u32 m0[4];
u32 m1[4];
u32 m2[4];
u32 m3[4];
m0[0] = swap32_S (salt_bufs[digests_offset].salt_buf[0]);
m0[1] = swap32_S (salt_bufs[digests_offset].salt_buf[1]);
m0[2] = swap32_S (salt_bufs[digests_offset].salt_buf[2]);
m0[3] = swap32_S (salt_bufs[digests_offset].salt_buf[3]);
m1[0] = 0;
m1[1] = 0;
m1[2] = 0;
m1[3] = 0;
m2[0] = 0;
m2[1] = 0;
m2[2] = 0;
m2[3] = 0;
m3[0] = 0;
m3[1] = 0;
m3[2] = 0;
m3[3] = 0;
sha1_hmac_ctx_t sha1_hmac_ctx;
sha1_hmac_init_64 (&sha1_hmac_ctx, k0, k1, k2, k3);
tmps[gid].ipad[0] = sha1_hmac_ctx.ipad.h[0];
tmps[gid].ipad[1] = sha1_hmac_ctx.ipad.h[1];
tmps[gid].ipad[2] = sha1_hmac_ctx.ipad.h[2];
tmps[gid].ipad[3] = sha1_hmac_ctx.ipad.h[3];
tmps[gid].ipad[4] = sha1_hmac_ctx.ipad.h[4];
tmps[gid].opad[0] = sha1_hmac_ctx.opad.h[0];
tmps[gid].opad[1] = sha1_hmac_ctx.opad.h[1];
tmps[gid].opad[2] = sha1_hmac_ctx.opad.h[2];
tmps[gid].opad[3] = sha1_hmac_ctx.opad.h[3];
tmps[gid].opad[4] = sha1_hmac_ctx.opad.h[4];
// first pbkdf iteration; key stretching
for (u32 i = 0, j = 1; i < 8; i += 5, j += 1)
{
m1[0] = j;
sha1_hmac_ctx_t sha1_hmac_ctx_loop = sha1_hmac_ctx;
sha1_hmac_update_64 (&sha1_hmac_ctx_loop, m0, m1, m2, m3, 20);
sha1_hmac_final (&sha1_hmac_ctx_loop);
tmps[gid].dgst[i + 0] = sha1_hmac_ctx_loop.opad.h[0];
tmps[gid].dgst[i + 1] = sha1_hmac_ctx_loop.opad.h[1];
tmps[gid].dgst[i + 2] = sha1_hmac_ctx_loop.opad.h[2];
tmps[gid].dgst[i + 3] = sha1_hmac_ctx_loop.opad.h[3];
tmps[gid].dgst[i + 4] = sha1_hmac_ctx_loop.opad.h[4];
tmps[gid].out[i + 0] = tmps[gid].dgst[i + 0];
tmps[gid].out[i + 1] = tmps[gid].dgst[i + 1];
tmps[gid].out[i + 2] = tmps[gid].dgst[i + 2];
tmps[gid].out[i + 3] = tmps[gid].dgst[i + 3];
tmps[gid].out[i + 4] = tmps[gid].dgst[i + 4];
}
}
__kernel void m18400_loop (KERN_ATTR_TMPS_ESALT (odf12_tmp_t, odf12_t))
{
const u64 gid = get_global_id (0);
if ((gid * VECT_SIZE) >= gid_max) return;
u32x ipad[5];
u32x opad[5];
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);
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);
// key stretching
for (u32 i = 0; i < 8; i += 5)
{
u32x dgst[5];
u32x out[5];
dgst[0] = packv (tmps, dgst, gid, i + 0);
dgst[1] = packv (tmps, dgst, gid, i + 1);
dgst[2] = packv (tmps, dgst, gid, i + 2);
dgst[3] = packv (tmps, dgst, gid, i + 3);
dgst[4] = packv (tmps, dgst, gid, i + 4);
out[0] = packv (tmps, out, gid, i + 0);
out[1] = packv (tmps, out, gid, i + 1);
out[2] = packv (tmps, out, gid, i + 2);
out[3] = packv (tmps, out, gid, i + 3);
out[4] = packv (tmps, out, gid, i + 4);
for (u32 j = 0; j < loop_cnt; j++)
{
u32x w0[4];
u32x w1[4];
u32x w2[4];
u32x 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_V (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];
}
unpackv (tmps, dgst, gid, i + 0, dgst[0]);
unpackv (tmps, dgst, gid, i + 1, dgst[1]);
unpackv (tmps, dgst, gid, i + 2, dgst[2]);
unpackv (tmps, dgst, gid, i + 3, dgst[3]);
unpackv (tmps, dgst, gid, i + 4, dgst[4]);
unpackv (tmps, out, gid, i + 0, out[0]);
unpackv (tmps, out, gid, i + 1, out[1]);
unpackv (tmps, out, gid, i + 2, out[2]);
unpackv (tmps, out, gid, i + 3, out[3]);
unpackv (tmps, out, gid, i + 4, out[4]);
}
}
__kernel void m18400_comp (KERN_ATTR_TMPS_ESALT (odf12_tmp_t, odf12_t))
{
const u64 gid = get_global_id (0);
const u64 lid = get_local_id (0);
const u64 lsz = get_local_size (0);
/**
* aes shared
*/
#ifdef REAL_SHM
__local u32 s_td0[256];
__local u32 s_td1[256];
__local u32 s_td2[256];
__local u32 s_td3[256];
__local u32 s_td4[256];
__local u32 s_te0[256];
__local u32 s_te1[256];
__local u32 s_te2[256];
__local u32 s_te3[256];
__local u32 s_te4[256];
for (MAYBE_VOLATILE u32 i = lid; i < 256; i += lsz)
{
s_td0[i] = td0[i];
s_td1[i] = td1[i];
s_td2[i] = td2[i];
s_td3[i] = td3[i];
s_td4[i] = td4[i];
s_te0[i] = te0[i];
s_te1[i] = te1[i];
s_te2[i] = te2[i];
s_te3[i] = te3[i];
s_te4[i] = te4[i];
}
barrier (CLK_LOCAL_MEM_FENCE);
#else
__constant u32a *s_td0 = td0;
__constant u32a *s_td1 = td1;
__constant u32a *s_td2 = td2;
__constant u32a *s_td3 = td3;
__constant u32a *s_td4 = td4;
__constant u32a *s_te0 = te0;
__constant u32a *s_te1 = te1;
__constant u32a *s_te2 = te2;
__constant u32a *s_te3 = te3;
__constant u32a *s_te4 = te4;
#endif
if (gid >= gid_max) return;
/**
* base
*/
u32 ukey[8];
ukey[0] = swap32_S (tmps[gid].out[0]);
ukey[1] = swap32_S (tmps[gid].out[1]);
ukey[2] = swap32_S (tmps[gid].out[2]);
ukey[3] = swap32_S (tmps[gid].out[3]);
ukey[4] = swap32_S (tmps[gid].out[4]);
ukey[5] = swap32_S (tmps[gid].out[5]);
ukey[6] = swap32_S (tmps[gid].out[6]);
ukey[7] = swap32_S (tmps[gid].out[7]);
u32 ks[60];
aes256_set_decrypt_key (ks, ukey, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4);
__global const odf12_t *es = &esalt_bufs[digests_offset];
u32 iv[4];
iv[0] = es->iv[0];
iv[1] = es->iv[1];
iv[2] = es->iv[2];
iv[3] = es->iv[3];
u32 ct[4];
u32 pt1[4];
u32 pt2[4];
u32 pt3[4];
u32 pt4[4];
sha256_ctx_t sha256_ctx;
sha256_init (&sha256_ctx);
// decrypt aes-cbc and calculate plaintext checksum at the same time
for (int i = 0; i < 16; i++)
{
const int i16 = i * 16;
ct[0] = es->encrypted_data[i16 + 0];
ct[1] = es->encrypted_data[i16 + 1];
ct[2] = es->encrypted_data[i16 + 2];
ct[3] = es->encrypted_data[i16 + 3];
aes256_decrypt (ks, ct, pt1, s_td0, s_td1, s_td2, s_td3, s_td4);
pt1[0] ^= iv[0];
pt1[1] ^= iv[1];
pt1[2] ^= iv[2];
pt1[3] ^= iv[3];
iv[0] = ct[0];
iv[1] = ct[1];
iv[2] = ct[2];
iv[3] = ct[3];
ct[0] = es->encrypted_data[i16 + 4];
ct[1] = es->encrypted_data[i16 + 5];
ct[2] = es->encrypted_data[i16 + 6];
ct[3] = es->encrypted_data[i16 + 7];
aes256_decrypt (ks, ct, pt2, s_td0, s_td1, s_td2, s_td3, s_td4);
pt2[0] ^= iv[0];
pt2[1] ^= iv[1];
pt2[2] ^= iv[2];
pt2[3] ^= iv[3];
iv[0] = ct[0];
iv[1] = ct[1];
iv[2] = ct[2];
iv[3] = ct[3];
ct[0] = es->encrypted_data[i16 + 8];
ct[1] = es->encrypted_data[i16 + 9];
ct[2] = es->encrypted_data[i16 + 10];
ct[3] = es->encrypted_data[i16 + 11];
aes256_decrypt (ks, ct, pt3, s_td0, s_td1, s_td2, s_td3, s_td4);
pt3[0] ^= iv[0];
pt3[1] ^= iv[1];
pt3[2] ^= iv[2];
pt3[3] ^= iv[3];
iv[0] = ct[0];
iv[1] = ct[1];
iv[2] = ct[2];
iv[3] = ct[3];
ct[0] = es->encrypted_data[i16 + 12];
ct[1] = es->encrypted_data[i16 + 13];
ct[2] = es->encrypted_data[i16 + 14];
ct[3] = es->encrypted_data[i16 + 15];
aes256_decrypt (ks, ct, pt4, s_td0, s_td1, s_td2, s_td3, s_td4);
pt4[0] ^= iv[0];
pt4[1] ^= iv[1];
pt4[2] ^= iv[2];
pt4[3] ^= iv[3];
iv[0] = ct[0];
iv[1] = ct[1];
iv[2] = ct[2];
iv[3] = ct[3];
pt1[0] = swap32_S (pt1[0]);
pt1[1] = swap32_S (pt1[1]);
pt1[2] = swap32_S (pt1[2]);
pt1[3] = swap32_S (pt1[3]);
pt2[0] = swap32_S (pt2[0]);
pt2[1] = swap32_S (pt2[1]);
pt2[2] = swap32_S (pt2[2]);
pt2[3] = swap32_S (pt2[3]);
pt3[0] = swap32_S (pt3[0]);
pt3[1] = swap32_S (pt3[1]);
pt3[2] = swap32_S (pt3[2]);
pt3[3] = swap32_S (pt3[3]);
pt4[0] = swap32_S (pt4[0]);
pt4[1] = swap32_S (pt4[1]);
pt4[2] = swap32_S (pt4[2]);
pt4[3] = swap32_S (pt4[3]);
sha256_update_64 (&sha256_ctx, pt1, pt2, pt3, pt4, 64);
}
sha256_final (&sha256_ctx);
const u32 r0 = swap32_S (sha256_ctx.h[0]);
const u32 r1 = swap32_S (sha256_ctx.h[1]);
const u32 r2 = swap32_S (sha256_ctx.h[2]);
const u32 r3 = swap32_S (sha256_ctx.h[3]);
#define il_pos 0
#include COMPARE_M
}

@ -1,5 +1,23 @@
* changes v5.1.0 -> v5.x.x
##
## Algorithms
##
- Added hash-mode 18400 (Open Document Format (ODF) 1.2 (SHA-256, AES))
##
## Bugs
##
- Fixed output of IKE PSK (mode 5300 and 5400) hashes to have separators at right position
##
## Technical
##
- Tests: Added hash-mode 18400 (Open Document Format (ODF) 1.2 (SHA-256, AES))
* changes v5.0.0 -> v5.1.0
##
@ -242,7 +260,7 @@
- Added hash-mode 16300 = Ethereum Pre-Sale Wallet, PBKDF2-SHA256
- Added hash-mode 16400 = CRAM-MD5 Dovecot
- Added hash-mode 16500 = JWT (JSON Web Token)
- Added hash-mode 16600 = Electrum Wallet (Salt-Type 1-3)
- Added hash-mode 16600 = Electrum Wallet (Salt-Type 1)
##
## Bugs

@ -244,6 +244,7 @@ NVIDIA GPUs require "NVIDIA Driver" (367.x or later)
- PDF 1.7 Level 3 (Acrobat 9)
- PDF 1.7 Level 8 (Acrobat 10 - 11)
- Apple Secure Notes
- Open Document Format (ODF) 1.2 (SHA-256, AES)
- Password Safe v2
- Password Safe v3
- LastPass + LastPass sniffed
@ -252,7 +253,7 @@ NVIDIA GPUs require "NVIDIA Driver" (367.x or later)
- Bitcoin/Litecoin wallet.dat
- Blockchain, My Wallet
- Blockchain, My Wallet, V2
- Electrum Wallet (Salt-Type 1-3)
- Electrum Wallet (Salt-Type 1-2)
- KeePass 1 (AES/Twofish) and KeePass 2 (AES)
- JKS Java Key Store Private Keys (SHA1)
- Ethereum Wallet, PBKDF2-HMAC-SHA256

@ -176,7 +176,7 @@ _hashcat ()
{
local VERSION=5.1.0
local HASH_MODES="0 10 11 12 20 21 22 23 30 40 50 60 100 101 110 111 112 120 121 122 124 130 131 132 133 140 141 150 160 200 300 400 500 501 600 900 1000 1100 1400 1410 1411 1420 1421 1430 1440 1441 1450 1460 1500 1600 1700 1710 1711 1720 1722 1730 1731 1740 1750 1760 1800 2100 2400 2410 2500 2501 2600 2611 2612 2711 2811 3000 3100 3200 3710 3711 3800 3910 4010 4110 4300 4400 4500 4520 4521 4522 4700 4800 4900 5100 5200 5300 5400 5500 5600 5700 5800 6000 6100 6211 6212 6213 6221 6222 6223 6231 6232 6233 6241 6242 6243 6300 6400 6500 6600 6700 6800 6900 7000 7100 7200 7300 7400 7500 7700 7800 7900 8000 8100 8200 8300 8400 8500 8600 8700 8800 8900 9000 9100 9200 9300 9400 9500 9600 9700 9710 9720 9800 9810 9820 9900 10000 10100 10200 10300 10400 10410 10420 10500 10600 10700 10800 10900 11000 11100 11200 11300 11400 11500 11600 11700 11800 11850 11860 11900 12000 12001 12100 12200 12300 12400 12500 12600 12700 12800 12900 13000 13100 13200 13300 13400 13500 13600 13800 13900 14000 14100 14700 14800 14900 15000 15100 15200 15300 15400 15500 15600 15700 15900 16000 16100 16200 16300 16400 16500 16600 16700 16800 16801 16900 17300 17400 17500 17600 17700 17800 17900 18000 18100 18200 18300"
local HASH_MODES="0 10 11 12 20 21 22 23 30 40 50 60 100 101 110 111 112 120 121 122 124 130 131 132 133 140 141 150 160 200 300 400 500 501 600 900 1000 1100 1400 1410 1411 1420 1421 1430 1440 1441 1450 1460 1500 1600 1700 1710 1711 1720 1722 1730 1731 1740 1750 1760 1800 2100 2400 2410 2500 2501 2600 2611 2612 2711 2811 3000 3100 3200 3710 3711 3800 3910 4010 4110 4300 4400 4500 4520 4521 4522 4700 4800 4900 5100 5200 5300 5400 5500 5600 5700 5800 6000 6100 6211 6212 6213 6221 6222 6223 6231 6232 6233 6241 6242 6243 6300 6400 6500 6600 6700 6800 6900 7000 7100 7200 7300 7400 7500 7700 7800 7900 8000 8100 8200 8300 8400 8500 8600 8700 8800 8900 9000 9100 9200 9300 9400 9500 9600 9700 9710 9720 9800 9810 9820 9900 10000 10100 10200 10300 10400 10410 10420 10500 10600 10700 10800 10900 11000 11100 11200 11300 11400 11500 11600 11700 11800 11850 11860 11900 12000 12001 12100 12200 12300 12400 12500 12600 12700 12800 12900 13000 13100 13200 13300 13400 13500 13600 13800 13900 14000 14100 14700 14800 14900 15000 15100 15200 15300 15400 15500 15600 15700 15900 16000 16100 16200 16300 16400 16500 16600 16700 16800 16801 16900 17300 17400 17500 17600 17700 17800 17900 18000 18100 18200 18300 18400"
local ATTACK_MODES="0 1 3 6 7"
local HCCAPX_MESSAGE_PAIRS="0 1 2 3 4 5"
local OUTFILE_FORMATS="1 2 3 4 5 6 7 8 9 10 11 12 13 14 15"

@ -423,6 +423,25 @@ typedef struct oldoffice34
} oldoffice34_t;
typedef struct odf12_tmp
{
u32 ipad[5];
u32 opad[5];
u32 dgst[10];
u32 out[10];
} odf12_tmp_t;
typedef struct odf12
{
u32 iterations;
u32 iv[4];
u32 checksum[8];
u32 encrypted_data[256];
} odf12_t;
typedef struct pstoken
{
u32 salt_buf[128];
@ -1149,6 +1168,7 @@ typedef enum hash_type
HASH_TYPE_WPA_PMKID_PMK = 69,
HASH_TYPE_ANSIBLE_VAULT = 70,
HASH_TYPE_KRB5ASREP = 71,
HASH_TYPE_ODF12 = 72,
} hash_type_t;
@ -1376,6 +1396,7 @@ typedef enum kern_type
KERN_TYPE_TOTP_HMACSHA1 = 18100,
KERN_TYPE_KRB5ASREP = 18200,
KERN_TYPE_APFS = 18300,
KERN_TYPE_ODF12 = 18400,
KERN_TYPE_PLAINTEXT = 99999,
} kern_type_t;
@ -1419,6 +1440,7 @@ typedef enum rounds_count
ROUNDS_OFFICE2007 = 50000,
ROUNDS_OFFICE2010 = 100000,
ROUNDS_OFFICE2013 = 100000,
ROUNDS_LIBREOFFICE = 100000,
ROUNDS_DJANGOPBKDF2 = 20000,
ROUNDS_SAPH_SHA1 = 1024,
ROUNDS_PDF14 = (50 + 20),

@ -921,7 +921,7 @@ bool brain_client_connect (hc_device_param_t *device_param, const status_ctx_t *
char port_str[8];
snprintf (port_str, sizeof (port_str) - 1, "%i", port);
snprintf (port_str, sizeof (port_str), "%i", port);
const char *host_real = (host == NULL) ? "127.0.0.1" : (const char *) host;
@ -1563,7 +1563,7 @@ bool brain_server_write_hash_dumps (brain_server_dbs_t *brain_server_dbs, const
char file[100];
snprintf (file, sizeof (file) - 1, "%s/brain.%08x.ldmp", path, brain_server_db_hash->brain_session);
snprintf (file, sizeof (file), "%s/brain.%08x.ldmp", path, brain_server_db_hash->brain_session);
brain_server_write_hash_dump (brain_server_db_hash, file);
@ -1762,7 +1762,7 @@ bool brain_server_write_attack_dumps (brain_server_dbs_t *brain_server_dbs, cons
char file[100];
snprintf (file, sizeof (file) - 1, "%s/brain.%08x.admp", path, brain_server_db_attack->brain_attack);
snprintf (file, sizeof (file), "%s/brain.%08x.admp", path, brain_server_db_attack->brain_attack);
brain_server_write_attack_dump (brain_server_db_attack, file);
@ -2972,7 +2972,7 @@ int brain_server (const char *listen_host, const int listen_port, const char *br
auth_password = (char *) hcmalloc (BRAIN_PASSWORD_SZ);
snprintf (auth_password, BRAIN_PASSWORD_SZ - 1, "%08x%08x", brain_auth_challenge (), brain_auth_challenge ());
snprintf (auth_password, BRAIN_PASSWORD_SZ, "%08x%08x", brain_auth_challenge (), brain_auth_challenge ());
brain_logging (stdout, 0, "Generated authentication password: %s\n", auth_password);
}

@ -100,12 +100,12 @@ static void get_install_dir (char *install_dir, const char *exec_path)
#if defined (_POSIX)
static void get_profile_dir (char *profile_dir, const char *home_dir)
{
snprintf (profile_dir, HCBUFSIZ_TINY - 1, "%s/%s", home_dir, DOT_HASHCAT);
snprintf (profile_dir, HCBUFSIZ_TINY, "%s/%s", home_dir, DOT_HASHCAT);
}
static void get_session_dir (char *session_dir, const char *profile_dir)
{
snprintf (session_dir, HCBUFSIZ_TINY - 1, "%s/%s", profile_dir, SESSIONS_FOLDER);
snprintf (session_dir, HCBUFSIZ_TINY, "%s/%s", profile_dir, SESSIONS_FOLDER);
}
#endif

@ -71,7 +71,7 @@ static char *hm_SYSFS_get_syspath_hwmon (hashcat_ctx_t *hashcat_ctx, const int d
char *hwmon = hcmalloc (HCBUFSIZ_TINY);
snprintf (hwmon, HCBUFSIZ_TINY - 1, "%s/hwmon", syspath);
snprintf (hwmon, HCBUFSIZ_TINY, "%s/hwmon", syspath);
char *hwmonN = first_file_in_directory (hwmon);
@ -87,7 +87,7 @@ static char *hm_SYSFS_get_syspath_hwmon (hashcat_ctx_t *hashcat_ctx, const int d
return NULL;
}
snprintf (hwmon, HCBUFSIZ_TINY - 1, "%s/hwmon/%s", syspath, hwmonN);
snprintf (hwmon, HCBUFSIZ_TINY, "%s/hwmon/%s", syspath, hwmonN);
hcfree (syspath);

File diff suppressed because it is too large Load Diff

@ -4889,9 +4889,9 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx)
char build_opts_base[1024] = { 0 };
#if defined (_WIN)
snprintf (build_opts_base, sizeof (build_opts_base) - 1, "-cl-std=CL1.2 -I OpenCL -I \"%s\"", folder_config->cpath_real);
snprintf (build_opts_base, sizeof (build_opts_base), "-cl-std=CL1.2 -I OpenCL -I \"%s\"", folder_config->cpath_real);
#else
snprintf (build_opts_base, sizeof (build_opts_base) - 1, "-cl-std=CL1.2 -I OpenCL -I %s", folder_config->cpath_real);
snprintf (build_opts_base, sizeof (build_opts_base), "-cl-std=CL1.2 -I OpenCL -I %s", folder_config->cpath_real);
#endif
// we don't have sm_* on vendors not NV but it doesn't matter
@ -4899,9 +4899,9 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx)
char build_opts[2048] = { 0 };
#if defined (DEBUG)
snprintf (build_opts, sizeof (build_opts) - 1, "%s -D LOCAL_MEM_TYPE=%u -D VENDOR_ID=%u -D CUDA_ARCH=%u -D AMD_ROCM=%u -D VECT_SIZE=%u -D DEVICE_TYPE=%u -D DGST_R0=%u -D DGST_R1=%u -D DGST_R2=%u -D DGST_R3=%u -D DGST_ELEM=%u -D KERN_TYPE=%u -D _unroll", build_opts_base, device_param->device_local_mem_type, device_param->platform_vendor_id, (device_param->sm_major * 100) + device_param->sm_minor, device_param->is_rocm, device_param->vector_width, (u32) device_param->device_type, hashconfig->dgst_pos0, hashconfig->dgst_pos1, hashconfig->dgst_pos2, hashconfig->dgst_pos3, hashconfig->dgst_size / 4, hashconfig->kern_type);
snprintf (build_opts, sizeof (build_opts), "%s -D LOCAL_MEM_TYPE=%u -D VENDOR_ID=%u -D CUDA_ARCH=%u -D AMD_ROCM=%u -D VECT_SIZE=%u -D DEVICE_TYPE=%u -D DGST_R0=%u -D DGST_R1=%u -D DGST_R2=%u -D DGST_R3=%u -D DGST_ELEM=%u -D KERN_TYPE=%u -D _unroll", build_opts_base, device_param->device_local_mem_type, device_param->platform_vendor_id, (device_param->sm_major * 100) + device_param->sm_minor, device_param->is_rocm, device_param->vector_width, (u32) device_param->device_type, hashconfig->dgst_pos0, hashconfig->dgst_pos1, hashconfig->dgst_pos2, hashconfig->dgst_pos3, hashconfig->dgst_size / 4, hashconfig->kern_type);
#else
snprintf (build_opts, sizeof (build_opts) - 1, "%s -D LOCAL_MEM_TYPE=%u -D VENDOR_ID=%u -D CUDA_ARCH=%u -D AMD_ROCM=%u -D VECT_SIZE=%u -D DEVICE_TYPE=%u -D DGST_R0=%u -D DGST_R1=%u -D DGST_R2=%u -D DGST_R3=%u -D DGST_ELEM=%u -D KERN_TYPE=%u -D _unroll -w", build_opts_base, device_param->device_local_mem_type, device_param->platform_vendor_id, (device_param->sm_major * 100) + device_param->sm_minor, device_param->is_rocm, device_param->vector_width, (u32) device_param->device_type, hashconfig->dgst_pos0, hashconfig->dgst_pos1, hashconfig->dgst_pos2, hashconfig->dgst_pos3, hashconfig->dgst_size / 4, hashconfig->kern_type);
snprintf (build_opts, sizeof (build_opts), "%s -D LOCAL_MEM_TYPE=%u -D VENDOR_ID=%u -D CUDA_ARCH=%u -D AMD_ROCM=%u -D VECT_SIZE=%u -D DEVICE_TYPE=%u -D DGST_R0=%u -D DGST_R1=%u -D DGST_R2=%u -D DGST_R3=%u -D DGST_ELEM=%u -D KERN_TYPE=%u -D _unroll -w", build_opts_base, device_param->device_local_mem_type, device_param->platform_vendor_id, (device_param->sm_major * 100) + device_param->sm_minor, device_param->is_rocm, device_param->vector_width, (u32) device_param->device_type, hashconfig->dgst_pos0, hashconfig->dgst_pos1, hashconfig->dgst_pos2, hashconfig->dgst_pos3, hashconfig->dgst_size / 4, hashconfig->kern_type);
#endif
/*
@ -4926,11 +4926,11 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx)
char *device_name_chksum_amp_mp = (char *) hcmalloc (HCBUFSIZ_TINY);
#if defined (__x86_64__)
const size_t dnclen = snprintf (device_name_chksum, HCBUFSIZ_TINY - 1, "%d-%u-%u-%s-%s-%s-%d-%u-%u", 64, device_param->platform_vendor_id, device_param->vector_width, device_param->device_name, device_param->device_version, device_param->driver_version, opencl_ctx->comptime, user_options->opencl_vector_width, user_options->hash_mode);
const size_t dnclen_amp_mp = snprintf (device_name_chksum_amp_mp, HCBUFSIZ_TINY - 1, "%d-%u-%s-%s-%s-%d", 64, device_param->platform_vendor_id, device_param->device_name, device_param->device_version, device_param->driver_version, opencl_ctx->comptime);
const size_t dnclen = snprintf (device_name_chksum, HCBUFSIZ_TINY, "%d-%u-%u-%s-%s-%s-%d-%u-%u", 64, device_param->platform_vendor_id, device_param->vector_width, device_param->device_name, device_param->device_version, device_param->driver_version, opencl_ctx->comptime, user_options->opencl_vector_width, user_options->hash_mode);
const size_t dnclen_amp_mp = snprintf (device_name_chksum_amp_mp, HCBUFSIZ_TINY, "%d-%u-%s-%s-%s-%d", 64, device_param->platform_vendor_id, device_param->device_name, device_param->device_version, device_param->driver_version, opencl_ctx->comptime);
#else
const size_t dnclen = snprintf (device_name_chksum, HCBUFSIZ_TINY - 1, "%d-%u-%u-%s-%s-%s-%d-%u-%u", 32, device_param->platform_vendor_id, device_param->vector_width, device_param->device_name, device_param->device_version, device_param->driver_version, opencl_ctx->comptime, user_options->opencl_vector_width, user_options->hash_mode);
const size_t dnclen_amp_mp = snprintf (device_name_chksum_amp_mp, HCBUFSIZ_TINY - 1, "%d-%u-%s-%s-%s-%d", 32, device_param->platform_vendor_id, device_param->device_name, device_param->device_version, device_param->driver_version, opencl_ctx->comptime);
const size_t dnclen = snprintf (device_name_chksum, HCBUFSIZ_TINY, "%d-%u-%u-%s-%s-%s-%d-%u-%u", 32, device_param->platform_vendor_id, device_param->vector_width, device_param->device_name, device_param->device_version, device_param->driver_version, opencl_ctx->comptime, user_options->opencl_vector_width, user_options->hash_mode);
const size_t dnclen_amp_mp = snprintf (device_name_chksum_amp_mp, HCBUFSIZ_TINY, "%d-%u-%s-%s-%s-%d", 32, device_param->platform_vendor_id, device_param->device_name, device_param->device_version, device_param->driver_version, opencl_ctx->comptime);
#endif
u32 device_name_digest[4] = { 0 };
@ -4940,7 +4940,7 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx)
md5_64 ((u32 *) (device_name_chksum + i), device_name_digest);
}
snprintf (device_name_chksum, HCBUFSIZ_TINY - 1, "%08x", device_name_digest[0]);
snprintf (device_name_chksum, HCBUFSIZ_TINY, "%08x", device_name_digest[0]);
u32 device_name_digest_amp_mp[4] = { 0 };
@ -4949,7 +4949,7 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx)
md5_64 ((u32 *) (device_name_chksum_amp_mp + i), device_name_digest_amp_mp);
}
snprintf (device_name_chksum_amp_mp, HCBUFSIZ_TINY - 1, "%08x", device_name_digest_amp_mp[0]);
snprintf (device_name_chksum_amp_mp, HCBUFSIZ_TINY, "%08x", device_name_digest_amp_mp[0]);
/**
* main kernel
@ -5734,7 +5734,7 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx)
{
// kernel1
snprintf (kernel_name, sizeof (kernel_name) - 1, "m%05u_s%02d", hashconfig->kern_type, 4);
snprintf (kernel_name, sizeof (kernel_name), "m%05u_s%02d", hashconfig->kern_type, 4);
CL_rc = hc_clCreateKernel (hashcat_ctx, device_param->program, kernel_name, &device_param->kernel1);
@ -5754,7 +5754,7 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx)
// kernel2
snprintf (kernel_name, sizeof (kernel_name) - 1, "m%05u_s%02d", hashconfig->kern_type, 8);
snprintf (kernel_name, sizeof (kernel_name), "m%05u_s%02d", hashconfig->kern_type, 8);
CL_rc = hc_clCreateKernel (hashcat_ctx, device_param->program, kernel_name, &device_param->kernel2);
@ -5774,7 +5774,7 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx)
// kernel3
snprintf (kernel_name, sizeof (kernel_name) - 1, "m%05u_s%02d", hashconfig->kern_type, 16);
snprintf (kernel_name, sizeof (kernel_name), "m%05u_s%02d", hashconfig->kern_type, 16);
CL_rc = hc_clCreateKernel (hashcat_ctx, device_param->program, kernel_name, &device_param->kernel3);
@ -5794,7 +5794,7 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx)
}
else
{
snprintf (kernel_name, sizeof (kernel_name) - 1, "m%05u_sxx", hashconfig->kern_type);
snprintf (kernel_name, sizeof (kernel_name), "m%05u_sxx", hashconfig->kern_type);
CL_rc = hc_clCreateKernel (hashcat_ctx, device_param->program, kernel_name, &device_param->kernel4);
@ -5819,7 +5819,7 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx)
{
// kernel1
snprintf (kernel_name, sizeof (kernel_name) - 1, "m%05u_m%02d", hashconfig->kern_type, 4);
snprintf (kernel_name, sizeof (kernel_name), "m%05u_m%02d", hashconfig->kern_type, 4);
CL_rc = hc_clCreateKernel (hashcat_ctx, device_param->program, kernel_name, &device_param->kernel1);
@ -5839,7 +5839,7 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx)
// kernel2
snprintf (kernel_name, sizeof (kernel_name) - 1, "m%05u_m%02d", hashconfig->kern_type, 8);
snprintf (kernel_name, sizeof (kernel_name), "m%05u_m%02d", hashconfig->kern_type, 8);
CL_rc = hc_clCreateKernel (hashcat_ctx, device_param->program, kernel_name, &device_param->kernel2);
@ -5859,7 +5859,7 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx)
// kernel3
snprintf (kernel_name, sizeof (kernel_name) - 1, "m%05u_m%02d", hashconfig->kern_type, 16);
snprintf (kernel_name, sizeof (kernel_name), "m%05u_m%02d", hashconfig->kern_type, 16);
CL_rc = hc_clCreateKernel (hashcat_ctx, device_param->program, kernel_name, &device_param->kernel3);
@ -5879,7 +5879,7 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx)
}
else
{
snprintf (kernel_name, sizeof (kernel_name) - 1, "m%05u_mxx", hashconfig->kern_type);
snprintf (kernel_name, sizeof (kernel_name), "m%05u_mxx", hashconfig->kern_type);
CL_rc = hc_clCreateKernel (hashcat_ctx, device_param->program, kernel_name, &device_param->kernel4);
@ -5908,7 +5908,7 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx)
{
if (hashconfig->opts_type & OPTS_TYPE_PT_BITSLICE)
{
snprintf (kernel_name, sizeof (kernel_name) - 1, "m%05u_tm", hashconfig->kern_type);
snprintf (kernel_name, sizeof (kernel_name), "m%05u_tm", hashconfig->kern_type);
CL_rc = hc_clCreateKernel (hashcat_ctx, device_param->program, kernel_name, &device_param->kernel_tm);
@ -5933,7 +5933,7 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx)
{
// kernel1
snprintf (kernel_name, sizeof (kernel_name) - 1, "m%05u_init", hashconfig->kern_type);
snprintf (kernel_name, sizeof (kernel_name), "m%05u_init", hashconfig->kern_type);
CL_rc = hc_clCreateKernel (hashcat_ctx, device_param->program, kernel_name, &device_param->kernel1);
@ -5953,7 +5953,7 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx)
// kernel2
snprintf (kernel_name, sizeof (kernel_name) - 1, "m%05u_loop", hashconfig->kern_type);
snprintf (kernel_name, sizeof (kernel_name), "m%05u_loop", hashconfig->kern_type);
CL_rc = hc_clCreateKernel (hashcat_ctx, device_param->program, kernel_name, &device_param->kernel2);
@ -5973,7 +5973,7 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx)
// kernel3
snprintf (kernel_name, sizeof (kernel_name) - 1, "m%05u_comp", hashconfig->kern_type);
snprintf (kernel_name, sizeof (kernel_name), "m%05u_comp", hashconfig->kern_type);
CL_rc = hc_clCreateKernel (hashcat_ctx, device_param->program, kernel_name, &device_param->kernel3);
@ -5995,7 +5995,7 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx)
if (hashconfig->opts_type & OPTS_TYPE_HOOK12)
{
snprintf (kernel_name, sizeof (kernel_name) - 1, "m%05u_hook12", hashconfig->kern_type);
snprintf (kernel_name, sizeof (kernel_name), "m%05u_hook12", hashconfig->kern_type);
CL_rc = hc_clCreateKernel (hashcat_ctx, device_param->program, kernel_name, &device_param->kernel12);
@ -6018,7 +6018,7 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx)
if (hashconfig->opts_type & OPTS_TYPE_HOOK23)
{
snprintf (kernel_name, sizeof (kernel_name) - 1, "m%05u_hook23", hashconfig->kern_type);
snprintf (kernel_name, sizeof (kernel_name), "m%05u_hook23", hashconfig->kern_type);
CL_rc = hc_clCreateKernel (hashcat_ctx, device_param->program, kernel_name, &device_param->kernel23);
@ -6041,7 +6041,7 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx)
if (hashconfig->opts_type & OPTS_TYPE_INIT2)
{
snprintf (kernel_name, sizeof (kernel_name) - 1, "m%05u_init2", hashconfig->kern_type);
snprintf (kernel_name, sizeof (kernel_name), "m%05u_init2", hashconfig->kern_type);
CL_rc = hc_clCreateKernel (hashcat_ctx, device_param->program, kernel_name, &device_param->kernel_init2);
@ -6064,7 +6064,7 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx)
if (hashconfig->opts_type & OPTS_TYPE_LOOP2)
{
snprintf (kernel_name, sizeof (kernel_name) - 1, "m%05u_loop2", hashconfig->kern_type);
snprintf (kernel_name, sizeof (kernel_name), "m%05u_loop2", hashconfig->kern_type);
CL_rc = hc_clCreateKernel (hashcat_ctx, device_param->program, kernel_name, &device_param->kernel_loop2);
@ -6087,7 +6087,7 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx)
if (hashconfig->opts_type & OPTS_TYPE_AUX1)
{
snprintf (kernel_name, sizeof (kernel_name) - 1, "m%05u_aux1", hashconfig->kern_type);
snprintf (kernel_name, sizeof (kernel_name), "m%05u_aux1", hashconfig->kern_type);
CL_rc = hc_clCreateKernel (hashcat_ctx, device_param->program, kernel_name, &device_param->kernel_aux1);
@ -6110,7 +6110,7 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx)
if (hashconfig->opts_type & OPTS_TYPE_AUX2)
{
snprintf (kernel_name, sizeof (kernel_name) - 1, "m%05u_aux2", hashconfig->kern_type);
snprintf (kernel_name, sizeof (kernel_name), "m%05u_aux2", hashconfig->kern_type);
CL_rc = hc_clCreateKernel (hashcat_ctx, device_param->program, kernel_name, &device_param->kernel_aux2);
@ -6133,7 +6133,7 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx)
if (hashconfig->opts_type & OPTS_TYPE_AUX3)
{
snprintf (kernel_name, sizeof (kernel_name) - 1, "m%05u_aux3", hashconfig->kern_type);
snprintf (kernel_name, sizeof (kernel_name), "m%05u_aux3", hashconfig->kern_type);
CL_rc = hc_clCreateKernel (hashcat_ctx, device_param->program, kernel_name, &device_param->kernel_aux3);
@ -6156,7 +6156,7 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx)
if (hashconfig->opts_type & OPTS_TYPE_AUX4)
{
snprintf (kernel_name, sizeof (kernel_name) - 1, "m%05u_aux4", hashconfig->kern_type);
snprintf (kernel_name, sizeof (kernel_name), "m%05u_aux4", hashconfig->kern_type);
CL_rc = hc_clCreateKernel (hashcat_ctx, device_param->program, kernel_name, &device_param->kernel_aux4);

@ -55,10 +55,10 @@ static char *status_get_rules_file (const hashcat_ctx_t *hashcat_ctx)
for (i = 0; i < user_options->rp_files_cnt - 1; i++)
{
tmp_len += snprintf (tmp_buf + tmp_len, HCBUFSIZ_TINY - tmp_len - 1, "%s, ", user_options->rp_files[i]);
tmp_len += snprintf (tmp_buf + tmp_len, HCBUFSIZ_TINY - tmp_len, "%s, ", user_options->rp_files[i]);
}
tmp_len += snprintf (tmp_buf + tmp_len, HCBUFSIZ_TINY - tmp_len - 1, "%s", user_options->rp_files[i]);
tmp_len += snprintf (tmp_buf + tmp_len, HCBUFSIZ_TINY - tmp_len, "%s", user_options->rp_files[i]);
tmp_buf[tmp_len] = 0;
@ -78,34 +78,34 @@ void format_timer_display (struct tm *tm, char *buf, size_t len)
const char *time_entity1 = ((tm->tm_year - 70) == 1) ? time_entities_s[0] : time_entities_m[0];
const char *time_entity2 = ( tm->tm_yday == 1) ? time_entities_s[1] : time_entities_m[1];
snprintf (buf, len - 1, "%d %s, %d %s", tm->tm_year - 70, time_entity1, tm->tm_yday, time_entity2);
snprintf (buf, len, "%d %s, %d %s", tm->tm_year - 70, time_entity1, tm->tm_yday, time_entity2);
}
else if (tm->tm_yday)
{
const char *time_entity1 = (tm->tm_yday == 1) ? time_entities_s[1] : time_entities_m[1];
const char *time_entity2 = (tm->tm_hour == 1) ? time_entities_s[2] : time_entities_m[2];
snprintf (buf, len - 1, "%d %s, %d %s", tm->tm_yday, time_entity1, tm->tm_hour, time_entity2);
snprintf (buf, len, "%d %s, %d %s", tm->tm_yday, time_entity1, tm->tm_hour, time_entity2);
}
else if (tm->tm_hour)
{
const char *time_entity1 = (tm->tm_hour == 1) ? time_entities_s[2] : time_entities_m[2];
const char *time_entity2 = (tm->tm_min == 1) ? time_entities_s[3] : time_entities_m[3];
snprintf (buf, len - 1, "%d %s, %d %s", tm->tm_hour, time_entity1, tm->tm_min, time_entity2);
snprintf (buf, len, "%d %s, %d %s", tm->tm_hour, time_entity1, tm->tm_min, time_entity2);
}
else if (tm->tm_min)
{
const char *time_entity1 = (tm->tm_min == 1) ? time_entities_s[3] : time_entities_m[3];
const char *time_entity2 = (tm->tm_sec == 1) ? time_entities_s[4] : time_entities_m[4];
snprintf (buf, len - 1, "%d %s, %d %s", tm->tm_min, time_entity1, tm->tm_sec, time_entity2);
snprintf (buf, len, "%d %s, %d %s", tm->tm_min, time_entity1, tm->tm_sec, time_entity2);
}
else
{
const char *time_entity1 = (tm->tm_sec == 1) ? time_entities_s[4] : time_entities_m[4];
snprintf (buf, len - 1, "%d %s", tm->tm_sec, time_entity1);
snprintf (buf, len, "%d %s", tm->tm_sec, time_entity1);
}
}
@ -133,11 +133,11 @@ void format_speed_display (double val, char *buf, size_t len)
if (level == 0)
{
snprintf (buf, len - 1, "%.0f ", val);
snprintf (buf, len, "%.0f ", val);
}
else
{
snprintf (buf, len - 1, "%.1f %c", val, UNITS[level]);
snprintf (buf, len, "%.1f %c", val, UNITS[level]);
}
}
@ -165,11 +165,11 @@ void format_speed_display_1k (double val, char *buf, size_t len)
if (level == 0)
{
snprintf (buf, len - 1, "%.0f ", val);
snprintf (buf, len, "%.0f ", val);
}
else
{
snprintf (buf, len - 1, "%.1f %c", val, UNITS[level]);
snprintf (buf, len, "%.1f %c", val, UNITS[level]);
}
}
@ -873,11 +873,11 @@ char *status_get_guess_candidates_dev (const hashcat_ctx_t *hashcat_ctx, const i
if (user_options_extra->attack_kern == ATTACK_KERN_BF)
{
snprintf (display, HCBUFSIZ_TINY - 1, "[Generating]");
snprintf (display, HCBUFSIZ_TINY, "[Generating]");
}
else
{
snprintf (display, HCBUFSIZ_TINY - 1, "[Copying]");
snprintf (display, HCBUFSIZ_TINY, "[Copying]");
}
if (device_param->skipped == true) return display;
@ -918,14 +918,14 @@ char *status_get_guess_candidates_dev (const hashcat_ctx_t *hashcat_ctx, const i
plain_ptr1[plain_len1 * 2] = 0;
plain_ptr2[plain_len2 * 2] = 0;
snprintf (display, HCBUFSIZ_TINY - 1, "$HEX[%s] -> $HEX[%s]", plain_ptr1, plain_ptr2);
snprintf (display, HCBUFSIZ_TINY, "$HEX[%s] -> $HEX[%s]", plain_ptr1, plain_ptr2);
}
else
{
plain_ptr1[plain_len1] = 0;
plain_ptr2[plain_len2] = 0;
snprintf (display, HCBUFSIZ_TINY - 1, "%s -> %s", plain_ptr1, plain_ptr2);
snprintf (display, HCBUFSIZ_TINY, "%s -> %s", plain_ptr1, plain_ptr2);
}
return display;
@ -1160,13 +1160,13 @@ char *status_get_time_estimated_relative (const hashcat_ctx_t *hashcat_ctx)
format_timer_display (tmp_left, display_left, HCBUFSIZ_TINY);
snprintf (display, HCBUFSIZ_TINY - 1, "%s; Runtime limited: %s", tmp_display, display_left);
snprintf (display, HCBUFSIZ_TINY, "%s; Runtime limited: %s", tmp_display, display_left);
free (display_left);
}
else
{
snprintf (display, HCBUFSIZ_TINY - 1, "%s; Runtime limit exceeded", tmp_display);
snprintf (display, HCBUFSIZ_TINY, "%s; Runtime limit exceeded", tmp_display);
}
free (tmp_display);
@ -1895,7 +1895,7 @@ char *status_get_brain_link_recv_bytes_sec_dev (const hashcat_ctx_t *hashcat_ctx
char *display = (char *) hcmalloc (HCBUFSIZ_TINY);
snprintf (display, HCBUFSIZ_TINY - 1, "%.2f M", (double) (brain_link_recv_bytes * 8) / 1024 / 1024);
snprintf (display, HCBUFSIZ_TINY, "%.2f M", (double) (brain_link_recv_bytes * 8) / 1024 / 1024);
return display;
}
@ -1922,7 +1922,7 @@ char *status_get_brain_link_send_bytes_sec_dev (const hashcat_ctx_t *hashcat_ctx
char *display = (char *) hcmalloc (HCBUFSIZ_TINY);
snprintf (display, HCBUFSIZ_TINY - 1, "%.2f M", (double) (brain_link_send_bytes * 8) / 1024 / 1024);
snprintf (display, HCBUFSIZ_TINY, "%.2f M", (double) (brain_link_send_bytes * 8) / 1024 / 1024);
return display;
}
@ -1936,7 +1936,7 @@ char *status_get_hwmon_dev (const hashcat_ctx_t *hashcat_ctx, const int device_i
char *output_buf = (char *) hcmalloc (HCBUFSIZ_TINY);
snprintf (output_buf, HCBUFSIZ_TINY - 1, "N/A");
snprintf (output_buf, HCBUFSIZ_TINY, "N/A");
if (device_param->skipped == true) return output_buf;
@ -1991,7 +1991,7 @@ char *status_get_hwmon_dev (const hashcat_ctx_t *hashcat_ctx, const int device_i
}
else
{
snprintf (output_buf, HCBUFSIZ_TINY - 1, "N/A");
snprintf (output_buf, HCBUFSIZ_TINY, "N/A");
}
hc_thread_mutex_unlock (status_ctx->mux_hwmon);

@ -393,6 +393,7 @@ static const char *const USAGE_BIG[] =
" 10600 | PDF 1.7 Level 3 (Acrobat 9) | Documents",
" 10700 | PDF 1.7 Level 8 (Acrobat 10 - 11) | Documents",
" 16200 | Apple Secure Notes | Documents",
" 18400 | Open Document Format (ODF) 1.2 (SHA-256, AES) | Documents",
" 9000 | Password Safe v2 | Password Managers",
" 5200 | Password Safe v3 | Password Managers",
" 6800 | LastPass + LastPass sniffed | Password Managers",
@ -401,7 +402,7 @@ static const char *const USAGE_BIG[] =
" 11300 | Bitcoin/Litecoin wallet.dat | Password Managers",
" 12700 | Blockchain, My Wallet | Password Managers",
" 15200 | Blockchain, My Wallet, V2 | Password Managers",
" 16600 | Electrum Wallet (Salt-Type 1-3) | Password Managers",
" 16600 | Electrum Wallet (Salt-Type 1-2) | Password Managers",
" 13400 | KeePass 1 (AES/Twofish) and KeePass 2 (AES) | Password Managers",
" 15500 | JKS Java Key Store Private Keys (SHA1) | Password Managers",
" 15600 | Ethereum Wallet, PBKDF2-HMAC-SHA256 | Password Managers",

@ -29,6 +29,7 @@ use Crypt::Digest::RIPEMD160 qw (ripemd160_hex);
use Crypt::Digest::Whirlpool qw (whirlpool_hex);
use Crypt::ECB qw (encrypt);
use Crypt::Eksblowfish::Bcrypt qw (bcrypt en_base64);
use Crypt::Mode::CBC;
use Crypt::Mode::ECB;
use Crypt::MySQL qw (password41);
use Crypt::OpenSSH::ChachaPoly;
@ -93,7 +94,7 @@ my $MODES =
13400, 13500, 13600, 13800, 13900, 14000, 14100, 14400, 14700, 14800, 14900,
15000, 15100, 15200, 15300, 15400, 15500, 15600, 15700, 15900, 16000, 16100,
16200, 16300, 16400, 16500, 16600, 16700, 16800, 16900, 17300, 17400, 17500,
17600, 17700, 17800, 17900, 18000, 18100, 18200, 18300, 99999
17600, 17700, 17800, 17900, 18000, 18100, 18200, 18300, 18400, 99999
];
## STEP 2a: If your hash mode does not need a salt, add it to this array.
@ -3166,6 +3167,65 @@ sub verify
next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in})));
}
elsif ($mode == 18400)
{
($hash_in, $word) = split ":", $line;
next unless defined $hash_in;
next unless defined $word;
# tokenize
my @data = split ('\*', $hash_in);
next unless scalar @data == 12;
my $signature = shift @data;
my $cipher_type = shift @data;
my $cs_type = shift @data;
$iter = shift @data;
my $cs_len = shift @data;
my $cs = shift @data;
my $iv_len = shift @data;
my $iv = shift @data;
my $salt_len = shift @data;
$salt = shift @data;
my $unused = shift @data;
my $ciphertext = shift @data;
# validate
next unless ($signature eq '$odf$');
next unless ($cipher_type eq '1');
next unless ($cs_type eq '1');
next unless ($cs_len eq '32');
next unless ($iv_len eq '16');
next unless ($salt_len eq '16');
next unless ($unused eq '0');
next unless defined $ciphertext;
# decrypt
my $b_iv = pack ("H*", $iv);
my $b_salt = pack ("H*", $salt);
my $b_ciphertext = pack ("H*", $ciphertext);
my $kdf = Crypt::PBKDF2->new
(
hash_class => 'HMACSHA1',
iterations => $iter,
output_len => 32,
);
my $pass_hash = sha256 ($word);
my $derived_key = $kdf->PBKDF2 ($b_salt, $pass_hash);
my $cbc = Crypt::Mode::CBC->new('AES', 0);
my $b_plaintext = $cbc->decrypt($b_ciphertext, $derived_key, $b_iv);
my $plaintext = unpack ("H*", $b_plaintext);
$param = $iv;
$param2 = $plaintext;
next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in})));
}
## STEP 2c: Add your custom salt branch here
else
{
@ -3654,6 +3714,15 @@ sub verify
return unless (substr ($line, 0, $len) eq $hash_out);
}
elsif ($mode == 18400)
{
$hash_out = gen_hash ($mode, $word, $salt, $iter, $param, $param2);
$len = length $hash_out;
return unless (substr ($line, 0, $len) eq $hash_out);
}
## STEP 2c: Add your custom gen_hash call here
else
{
$hash_out = gen_hash ($mode, $word, $salt, $iter);
@ -4257,6 +4326,10 @@ sub passthrough
{
$tmp_hash = gen_hash ($mode, $word_buf, substr ($salt_buf, 0, 32));
}
elsif ($mode == 18400)
{
$tmp_hash = gen_hash ($mode, $word_buf, substr ($salt_buf, 0, 32));
}
## STEP 2c: Add your custom salt branch here
else
{
@ -5429,6 +5502,20 @@ sub single
}
}
}
elsif ($mode == 18400)
{
for (my $i = 1; $i < 32; $i++)
{
if ($len != 0)
{
rnd ($mode, $len, 32);
}
else
{
rnd ($mode, $i, 32);
}
}
}
## STEP 2c: Add your custom salt branch here
}
}
@ -10597,6 +10684,52 @@ END_CODE
$tmp_hash = sprintf ('$fvde$%d$%d$%s$%d$%s', $Z_PK, length ($salt_bin), unpack ("H*", $salt_bin), $iterations, unpack ("H*", $blob_bin));
}
elsif ($mode == 18400)
{
# defaults for single mode
my $iterations = 100000;
my $iv = "aa" x 16;
my $plaintext = "bb" x 1024;
# parameters for verify mode
if (defined $iter)
{
$iterations = $iter;
}
if (defined $additional_param)
{
$iv = $additional_param;
}
if (defined $additional_param2)
{
$plaintext = $additional_param2;
}
# binary buffers
my $b_iv = pack ("H*", $iv);
my $b_salt = pack ("H*", $salt_buf);
my $b_plaintext = pack ("H*", $plaintext);
my $kdf = Crypt::PBKDF2->new
(
hash_class => 'HMACSHA1',
iterations => $iterations,
output_len => 32,
);
my $checksum = sha256_hex ($b_plaintext);
my $pass_hash = sha256 ($word_buf);
my $derived_key = $kdf->PBKDF2 ($b_salt, $pass_hash);
my $cbc = Crypt::Mode::CBC->new('AES', 0);
my $b_ciphertext = $cbc->encrypt($b_plaintext, $derived_key, $b_iv);
my $ciphertext = unpack ("H*", $b_ciphertext);
$tmp_hash = '$odf$'."*1*1*$iterations*32*$checksum*16*$iv*16*$salt_buf*0*$ciphertext";
}
elsif ($mode == 99999)
{
$tmp_hash = sprintf ("%s", $word_buf);

@ -30,7 +30,7 @@ HASH_TYPES="0 10 11 12 20 21 22 23 30 40 50 60\
13751 13752 13753 13771 13772 13773 13800 13900 14000 14100 14400 14600 14700\
14800 14900 15000 15100 15200 15300 15400 15500 15600 15700 15900 16000 16100\
16200 16300 16400 16500 16600 16700 16800 16900 17300 17400 17500 17600 17700\
17800 17900 18000 18100 18200 18300 99999"
17800 17900 18000 18100 18200 18300 18400 99999"
VECTOR_WIDTHS="1 2 4 8 16"
@ -48,7 +48,7 @@ SLOW_ALGOS=" 400 500 501 1600 1800 2100 2500 3200 5200 5800 6211\
12900 13000 13200 13400 13600 13711 13712 13713 13721 13722 13723 13731 13732\
13733 13751 13752 13753 13771 13772 13773 14600 14611 14612 14613 14621 14622\
14623 14631 14632 14633 14641 14642 14643 14700 14800 15100 15200 15300 15600\
15700 15900 16000 16200 16300 16800 16900"
15700 15900 16000 16200 16300 16800 16900 18400"
# List of VeraCrypt modes which have test containers
VC_MODES="13711 13712 13713 13721 13722 13723 13731 13732 13733 13751 13752\

Loading…
Cancel
Save