mirror of
https://github.com/hashcat/hashcat.git
synced 2025-01-05 05:11:03 +00:00
Fix -a 3 for -m 31400 in vector datatype mode
This commit is contained in:
parent
d820cfa48e
commit
074411418f
@ -22,33 +22,33 @@
|
|||||||
|
|
||||||
DECLSPEC void shift_buffer_by_offset (PRIVATE_AS u32 *w0, const u32 offset)
|
DECLSPEC void shift_buffer_by_offset (PRIVATE_AS u32 *w0, const u32 offset)
|
||||||
{
|
{
|
||||||
const int offset_switch = offset / 4;
|
const int offset_switch = offset / 4;
|
||||||
|
|
||||||
#if ((defined IS_AMD || defined IS_HIP) && HAS_VPERM == 0) || defined IS_GENERIC
|
#if ((defined IS_AMD || defined IS_HIP) && HAS_VPERM == 0) || defined IS_GENERIC
|
||||||
switch (offset_switch)
|
switch (offset_switch)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
w0[3] = hc_bytealign_be_S (w0[2], w0[3], offset);
|
w0[3] = hc_bytealign_be_S (w0[2], w0[3], offset);
|
||||||
w0[2] = hc_bytealign_be_S (w0[1], w0[2], offset);
|
w0[2] = hc_bytealign_be_S (w0[1], w0[2], offset);
|
||||||
w0[1] = hc_bytealign_be_S (w0[0], w0[1], offset);
|
w0[1] = hc_bytealign_be_S (w0[0], w0[1], offset);
|
||||||
w0[0] = hc_bytealign_be_S ( 0, w0[0], offset);
|
w0[0] = hc_bytealign_be_S ( 0, w0[0], offset);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 1:
|
case 1:
|
||||||
w0[3] = hc_bytealign_be_S (w0[1], w0[2], offset);
|
w0[3] = hc_bytealign_be_S (w0[1], w0[2], offset);
|
||||||
w0[2] = hc_bytealign_be_S (w0[0], w0[1], offset);
|
w0[2] = hc_bytealign_be_S (w0[0], w0[1], offset);
|
||||||
w0[1] = hc_bytealign_be_S ( 0, w0[0], offset);
|
w0[1] = hc_bytealign_be_S ( 0, w0[0], offset);
|
||||||
w0[0] = 0;
|
w0[0] = 0;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 2:
|
case 2:
|
||||||
w0[3] = hc_bytealign_be_S (w0[0], w0[1], offset);
|
w0[3] = hc_bytealign_be_S (w0[0], w0[1], offset);
|
||||||
w0[2] = hc_bytealign_be_S ( 0, w0[0], offset);
|
w0[2] = hc_bytealign_be_S ( 0, w0[0], offset);
|
||||||
w0[1] = 0;
|
w0[1] = 0;
|
||||||
w0[0] = 0;
|
w0[0] = 0;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 3:
|
case 3:
|
||||||
w0[3] = hc_bytealign_be_S ( 0, w0[0], offset);
|
w0[3] = hc_bytealign_be_S ( 0, w0[0], offset);
|
||||||
w0[2] = 0;
|
w0[2] = 0;
|
||||||
w0[1] = 0;
|
w0[1] = 0;
|
||||||
@ -61,7 +61,7 @@ const int offset_switch = offset / 4;
|
|||||||
w0[1] = 0;
|
w0[1] = 0;
|
||||||
w0[0] = 0;
|
w0[0] = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ((defined IS_AMD || defined IS_HIP) && HAS_VPERM == 1) || defined IS_NV
|
#if ((defined IS_AMD || defined IS_HIP) && HAS_VPERM == 1) || defined IS_NV
|
||||||
@ -71,33 +71,33 @@ const int offset_switch = offset / 4;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if (defined IS_AMD || defined IS_HIP)
|
#if (defined IS_AMD || defined IS_HIP)
|
||||||
const int selector = l32_from_64_S (0x0706050403020100UL >> ((offset & 3) * 8));
|
const int selector = l32_from_64_S(0x0706050403020100UL >> ((offset & 3) * 8));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
switch (offset_switch)
|
switch (offset_switch)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
w0[3] = hc_byte_perm_S (w0[3], w0[2], selector);
|
w0[3] = hc_byte_perm_S (w0[3], w0[2], selector);
|
||||||
w0[2] = hc_byte_perm_S (w0[2], w0[1], selector);
|
w0[2] = hc_byte_perm_S (w0[2], w0[1], selector);
|
||||||
w0[1] = hc_byte_perm_S (w0[1], w0[0], selector);
|
w0[1] = hc_byte_perm_S (w0[1], w0[0], selector);
|
||||||
w0[0] = hc_byte_perm_S (w0[0], 0, selector);
|
w0[0] = hc_byte_perm_S (w0[0], 0, selector);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 1:
|
case 1:
|
||||||
w0[3] = hc_byte_perm_S (w0[2], w0[1], selector);
|
w0[3] = hc_byte_perm_S (w0[2], w0[1], selector);
|
||||||
w0[2] = hc_byte_perm_S (w0[1], w0[0], selector);
|
w0[2] = hc_byte_perm_S (w0[1], w0[0], selector);
|
||||||
w0[1] = hc_byte_perm_S (w0[0], 0, selector);
|
w0[1] = hc_byte_perm_S (w0[0], 0, selector);
|
||||||
w0[0] = 0;
|
w0[0] = 0;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 2:
|
case 2:
|
||||||
w0[3] = hc_byte_perm_S (w0[1], w0[0], selector);
|
w0[3] = hc_byte_perm_S (w0[1], w0[0], selector);
|
||||||
w0[2] = hc_byte_perm_S (w0[0], 0, selector);
|
w0[2] = hc_byte_perm_S (w0[0], 0, selector);
|
||||||
w0[1] = 0;
|
w0[1] = 0;
|
||||||
w0[0] = 0;
|
w0[0] = 0;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 3:
|
case 3:
|
||||||
w0[3] = hc_byte_perm_S (w0[0], 0, selector);
|
w0[3] = hc_byte_perm_S (w0[0], 0, selector);
|
||||||
w0[2] = 0;
|
w0[2] = 0;
|
||||||
w0[1] = 0;
|
w0[1] = 0;
|
||||||
@ -114,115 +114,29 @@ const int offset_switch = offset / 4;
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DECLSPEC void aes256_scrt_format (PRIVATE_AS u32 *aes_ks, PRIVATE_AS u32 *pw, const u32 pw_len, PRIVATE_AS u32 *hash, PRIVATE_AS u32 *out, SHM_TYPE u32 *s_te0, SHM_TYPE u32 *s_te1, SHM_TYPE u32 *s_te2, SHM_TYPE u32 *s_te3, SHM_TYPE u32 *s_te4)
|
||||||
DECLSPEC void aes256_scrt_format (PRIVATE_AS u32 *aes_ks, PRIVATE_AS u32 *pw, const int pw_len, PRIVATE_AS u32 *hash, PRIVATE_AS u32 *out, SHM_TYPE u32 *s_te0, SHM_TYPE u32 *s_te1, SHM_TYPE u32 *s_te2, SHM_TYPE u32 *s_te3, SHM_TYPE u32 *s_te4)
|
|
||||||
{
|
{
|
||||||
AES256_set_encrypt_key(aes_ks, hash, s_te0, s_te1, s_te2, s_te3);
|
AES256_set_encrypt_key (aes_ks, hash, s_te0, s_te1, s_te2, s_te3);
|
||||||
|
|
||||||
shift_buffer_by_offset(hash,pw_len+4);
|
shift_buffer_by_offset (hash, pw_len + 4);
|
||||||
|
|
||||||
hash[0] = hc_swap32_S(pw_len);
|
hash[0] = hc_swap32_S (pw_len);
|
||||||
hash[1] |= hc_swap32_S(pw[0]);
|
hash[1] |= hc_swap32_S (pw[0]);
|
||||||
hash[2] |= hc_swap32_S(pw[1]);
|
hash[2] |= hc_swap32_S (pw[1]);
|
||||||
hash[3] |= hc_swap32_S(pw[2]);
|
hash[3] |= hc_swap32_S (pw[2]);
|
||||||
|
|
||||||
AES256_encrypt (aes_ks, hash, out, s_te0, s_te1, s_te2, s_te3, s_te4);
|
AES256_encrypt (aes_ks, hash, out, s_te0, s_te1, s_te2, s_te3, s_te4);
|
||||||
}
|
}
|
||||||
|
|
||||||
KERNEL_FQ void m31400_mxx (KERN_ATTR_RULES ())
|
KERNEL_FQ void m31400_mxx (KERN_ATTR_RULES ())
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* modifier
|
* modifier
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const u64 lid = get_local_id (0);
|
const u64 lid = get_local_id (0);
|
||||||
const u64 gid = get_global_id (0);
|
const u64 gid = get_global_id (0);
|
||||||
const u64 lsz = get_local_size (0);
|
const u64 lsz = get_local_size (0);
|
||||||
|
|
||||||
/**
|
|
||||||
* aes shared
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef REAL_SHM
|
|
||||||
|
|
||||||
LOCAL_VK u32 s_te0[256];
|
|
||||||
LOCAL_VK u32 s_te1[256];
|
|
||||||
LOCAL_VK u32 s_te2[256];
|
|
||||||
LOCAL_VK u32 s_te3[256];
|
|
||||||
LOCAL_VK u32 s_te4[256];
|
|
||||||
|
|
||||||
for (u32 i = lid; i < 256; i += lsz)
|
|
||||||
{
|
|
||||||
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];
|
|
||||||
}
|
|
||||||
|
|
||||||
SYNC_THREADS();
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
CONSTANT_AS u32a *s_te0 = te0;
|
|
||||||
CONSTANT_AS u32a *s_te1 = te1;
|
|
||||||
CONSTANT_AS u32a *s_te2 = te2;
|
|
||||||
CONSTANT_AS u32a *s_te3 = te3;
|
|
||||||
CONSTANT_AS u32a *s_te4 = te4;
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (gid >= GID_CNT) return;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* base
|
|
||||||
*/
|
|
||||||
|
|
||||||
COPY_PW (pws[gid]);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* loop
|
|
||||||
*/
|
|
||||||
|
|
||||||
u32 ks[60];
|
|
||||||
|
|
||||||
for (u32 il_pos = 0; il_pos < IL_CNT; il_pos++)
|
|
||||||
{
|
|
||||||
pw_t tmp = PASTE_PW;
|
|
||||||
|
|
||||||
tmp.pw_len = apply_rules (rules_buf[il_pos].cmds, tmp.i, tmp.pw_len);
|
|
||||||
|
|
||||||
sha256_ctx_t ctx;
|
|
||||||
|
|
||||||
sha256_init (&ctx);
|
|
||||||
|
|
||||||
sha256_update_swap (&ctx, tmp.i, tmp.pw_len);
|
|
||||||
|
|
||||||
sha256_final (&ctx);
|
|
||||||
|
|
||||||
u32 out[4]={0};
|
|
||||||
|
|
||||||
aes256_scrt_format(ks,tmp.i,tmp.pw_len,ctx.h,out,s_te0, s_te1, s_te2, s_te3, s_te4);
|
|
||||||
|
|
||||||
const u32 r0 = out[DGST_R0];
|
|
||||||
const u32 r1 = out[DGST_R1];
|
|
||||||
const u32 r2 = out[DGST_R2];
|
|
||||||
const u32 r3 = out[DGST_R3];
|
|
||||||
|
|
||||||
COMPARE_M_SCALAR (r0, r1, r2, r3);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
KERNEL_FQ void m31400_sxx (KERN_ATTR_RULES ())
|
|
||||||
{
|
|
||||||
|
|
||||||
/**
|
|
||||||
* modifier
|
|
||||||
*/
|
|
||||||
|
|
||||||
const u64 lid = get_local_id (0);
|
|
||||||
const u64 gid = get_global_id (0);
|
|
||||||
const u64 lsz = get_local_size (0);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* aes shared
|
* aes shared
|
||||||
@ -245,7 +159,7 @@ KERNEL_FQ void m31400_sxx (KERN_ATTR_RULES ())
|
|||||||
s_te4[i] = te4[i];
|
s_te4[i] = te4[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
SYNC_THREADS ();
|
SYNC_THREADS();
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
@ -257,55 +171,139 @@ KERNEL_FQ void m31400_sxx (KERN_ATTR_RULES ())
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (gid >= GID_CNT) return;
|
if (gid >= GID_CNT) return;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* digest
|
* base
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const u32 search[4] =
|
COPY_PW (pws[gid]);
|
||||||
{
|
|
||||||
digests_buf[DIGESTS_OFFSET_HOST].digest_buf[DGST_R0],
|
|
||||||
digests_buf[DIGESTS_OFFSET_HOST].digest_buf[DGST_R1],
|
|
||||||
digests_buf[DIGESTS_OFFSET_HOST].digest_buf[DGST_R2],
|
|
||||||
digests_buf[DIGESTS_OFFSET_HOST].digest_buf[DGST_R3]
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
u32 ks[60];
|
||||||
* base
|
|
||||||
*/
|
|
||||||
|
|
||||||
COPY_PW (pws[gid]);
|
/**
|
||||||
|
* loop
|
||||||
|
*/
|
||||||
|
|
||||||
u32 ks[60];
|
for (u32 il_pos = 0; il_pos < IL_CNT; il_pos++)
|
||||||
|
{
|
||||||
/**
|
pw_t tmp = PASTE_PW;
|
||||||
* loop
|
|
||||||
*/
|
|
||||||
|
|
||||||
for (u32 il_pos = 0; il_pos < IL_CNT; il_pos++)
|
tmp.pw_len = apply_rules (rules_buf[il_pos].cmds, tmp.i, tmp.pw_len);
|
||||||
{
|
|
||||||
pw_t tmp = PASTE_PW;
|
|
||||||
|
|
||||||
tmp.pw_len = apply_rules (rules_buf[il_pos].cmds, tmp.i, tmp.pw_len);
|
sha256_ctx_t ctx;
|
||||||
|
|
||||||
sha256_ctx_t ctx;
|
sha256_init (&ctx);
|
||||||
|
|
||||||
sha256_init (&ctx);
|
sha256_update_swap (&ctx, tmp.i, tmp.pw_len);
|
||||||
|
|
||||||
sha256_update_swap (&ctx, tmp.i, tmp.pw_len);
|
sha256_final (&ctx);
|
||||||
|
|
||||||
sha256_final (&ctx);
|
u32 out[4] = { 0 };
|
||||||
|
|
||||||
u32 out[4]={0};
|
aes256_scrt_format (ks, tmp.i, tmp.pw_len, ctx.h, out,s_te0, s_te1, s_te2, s_te3, s_te4);
|
||||||
|
|
||||||
aes256_scrt_format(ks,tmp.i,tmp.pw_len,ctx.h,out,s_te0, s_te1, s_te2, s_te3, s_te4);
|
const u32 r0 = out[DGST_R0];
|
||||||
|
const u32 r1 = out[DGST_R1];
|
||||||
|
const u32 r2 = out[DGST_R2];
|
||||||
|
const u32 r3 = out[DGST_R3];
|
||||||
|
|
||||||
const u32 r0 = out[DGST_R0];
|
COMPARE_M_SCALAR (r0, r1, r2, r3);
|
||||||
const u32 r1 = out[DGST_R1];
|
}
|
||||||
const u32 r2 = out[DGST_R2];
|
}
|
||||||
const u32 r3 = out[DGST_R3];
|
|
||||||
|
KERNEL_FQ void m31400_sxx (KERN_ATTR_RULES ())
|
||||||
COMPARE_S_SCALAR (r0, r1, r2, r3);
|
{
|
||||||
}
|
/**
|
||||||
|
* modifier
|
||||||
|
*/
|
||||||
|
|
||||||
|
const u64 lid = get_local_id (0);
|
||||||
|
const u64 gid = get_global_id (0);
|
||||||
|
const u64 lsz = get_local_size (0);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* aes shared
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef REAL_SHM
|
||||||
|
|
||||||
|
LOCAL_VK u32 s_te0[256];
|
||||||
|
LOCAL_VK u32 s_te1[256];
|
||||||
|
LOCAL_VK u32 s_te2[256];
|
||||||
|
LOCAL_VK u32 s_te3[256];
|
||||||
|
LOCAL_VK u32 s_te4[256];
|
||||||
|
|
||||||
|
for (u32 i = lid; i < 256; i += lsz)
|
||||||
|
{
|
||||||
|
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];
|
||||||
|
}
|
||||||
|
|
||||||
|
SYNC_THREADS();
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
CONSTANT_AS u32a *s_te0 = te0;
|
||||||
|
CONSTANT_AS u32a *s_te1 = te1;
|
||||||
|
CONSTANT_AS u32a *s_te2 = te2;
|
||||||
|
CONSTANT_AS u32a *s_te3 = te3;
|
||||||
|
CONSTANT_AS u32a *s_te4 = te4;
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (gid >= GID_CNT) return;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* digest
|
||||||
|
*/
|
||||||
|
|
||||||
|
const u32 search[4] =
|
||||||
|
{
|
||||||
|
digests_buf[DIGESTS_OFFSET_HOST].digest_buf[DGST_R0],
|
||||||
|
digests_buf[DIGESTS_OFFSET_HOST].digest_buf[DGST_R1],
|
||||||
|
digests_buf[DIGESTS_OFFSET_HOST].digest_buf[DGST_R2],
|
||||||
|
digests_buf[DIGESTS_OFFSET_HOST].digest_buf[DGST_R3]
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* base
|
||||||
|
*/
|
||||||
|
|
||||||
|
COPY_PW (pws[gid]);
|
||||||
|
|
||||||
|
u32 ks[60];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* loop
|
||||||
|
*/
|
||||||
|
|
||||||
|
for (u32 il_pos = 0; il_pos < IL_CNT; il_pos++)
|
||||||
|
{
|
||||||
|
pw_t tmp = PASTE_PW;
|
||||||
|
|
||||||
|
tmp.pw_len = apply_rules (rules_buf[il_pos].cmds, tmp.i, tmp.pw_len);
|
||||||
|
|
||||||
|
sha256_ctx_t ctx;
|
||||||
|
|
||||||
|
sha256_init (&ctx);
|
||||||
|
|
||||||
|
sha256_update_swap (&ctx, tmp.i, tmp.pw_len);
|
||||||
|
|
||||||
|
sha256_final (&ctx);
|
||||||
|
|
||||||
|
u32 out[4] = { 0 };
|
||||||
|
|
||||||
|
aes256_scrt_format (ks, tmp.i, tmp.pw_len, ctx.h, out,s_te0, s_te1, s_te2, s_te3, s_te4);
|
||||||
|
|
||||||
|
const u32 r0 = out[DGST_R0];
|
||||||
|
const u32 r1 = out[DGST_R1];
|
||||||
|
const u32 r2 = out[DGST_R2];
|
||||||
|
const u32 r3 = out[DGST_R3];
|
||||||
|
|
||||||
|
COMPARE_S_SCALAR (r0, r1, r2, r3);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,33 +22,33 @@
|
|||||||
|
|
||||||
DECLSPEC void shift_buffer_by_offset (PRIVATE_AS u32 *w0, const u32 offset)
|
DECLSPEC void shift_buffer_by_offset (PRIVATE_AS u32 *w0, const u32 offset)
|
||||||
{
|
{
|
||||||
const int offset_switch = offset / 4;
|
const int offset_switch = offset / 4;
|
||||||
|
|
||||||
#if ((defined IS_AMD || defined IS_HIP) && HAS_VPERM == 0) || defined IS_GENERIC
|
#if ((defined IS_AMD || defined IS_HIP) && HAS_VPERM == 0) || defined IS_GENERIC
|
||||||
switch (offset_switch)
|
switch (offset_switch)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
w0[3] = hc_bytealign_be_S (w0[2], w0[3], offset);
|
w0[3] = hc_bytealign_be_S (w0[2], w0[3], offset);
|
||||||
w0[2] = hc_bytealign_be_S (w0[1], w0[2], offset);
|
w0[2] = hc_bytealign_be_S (w0[1], w0[2], offset);
|
||||||
w0[1] = hc_bytealign_be_S (w0[0], w0[1], offset);
|
w0[1] = hc_bytealign_be_S (w0[0], w0[1], offset);
|
||||||
w0[0] = hc_bytealign_be_S ( 0, w0[0], offset);
|
w0[0] = hc_bytealign_be_S ( 0, w0[0], offset);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 1:
|
case 1:
|
||||||
w0[3] = hc_bytealign_be_S (w0[1], w0[2], offset);
|
w0[3] = hc_bytealign_be_S (w0[1], w0[2], offset);
|
||||||
w0[2] = hc_bytealign_be_S (w0[0], w0[1], offset);
|
w0[2] = hc_bytealign_be_S (w0[0], w0[1], offset);
|
||||||
w0[1] = hc_bytealign_be_S ( 0, w0[0], offset);
|
w0[1] = hc_bytealign_be_S ( 0, w0[0], offset);
|
||||||
w0[0] = 0;
|
w0[0] = 0;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 2:
|
case 2:
|
||||||
w0[3] = hc_bytealign_be_S (w0[0], w0[1], offset);
|
w0[3] = hc_bytealign_be_S (w0[0], w0[1], offset);
|
||||||
w0[2] = hc_bytealign_be_S ( 0, w0[0], offset);
|
w0[2] = hc_bytealign_be_S ( 0, w0[0], offset);
|
||||||
w0[1] = 0;
|
w0[1] = 0;
|
||||||
w0[0] = 0;
|
w0[0] = 0;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 3:
|
case 3:
|
||||||
w0[3] = hc_bytealign_be_S ( 0, w0[0], offset);
|
w0[3] = hc_bytealign_be_S ( 0, w0[0], offset);
|
||||||
w0[2] = 0;
|
w0[2] = 0;
|
||||||
w0[1] = 0;
|
w0[1] = 0;
|
||||||
@ -61,7 +61,7 @@ const int offset_switch = offset / 4;
|
|||||||
w0[1] = 0;
|
w0[1] = 0;
|
||||||
w0[0] = 0;
|
w0[0] = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ((defined IS_AMD || defined IS_HIP) && HAS_VPERM == 1) || defined IS_NV
|
#if ((defined IS_AMD || defined IS_HIP) && HAS_VPERM == 1) || defined IS_NV
|
||||||
@ -71,33 +71,33 @@ const int offset_switch = offset / 4;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if (defined IS_AMD || defined IS_HIP)
|
#if (defined IS_AMD || defined IS_HIP)
|
||||||
const int selector = l32_from_64_S (0x0706050403020100UL >> ((offset & 3) * 8));
|
const int selector = l32_from_64_S(0x0706050403020100UL >> ((offset & 3) * 8));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
switch (offset_switch)
|
switch (offset_switch)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
w0[3] = hc_byte_perm_S (w0[3], w0[2], selector);
|
w0[3] = hc_byte_perm_S (w0[3], w0[2], selector);
|
||||||
w0[2] = hc_byte_perm_S (w0[2], w0[1], selector);
|
w0[2] = hc_byte_perm_S (w0[2], w0[1], selector);
|
||||||
w0[1] = hc_byte_perm_S (w0[1], w0[0], selector);
|
w0[1] = hc_byte_perm_S (w0[1], w0[0], selector);
|
||||||
w0[0] = hc_byte_perm_S (w0[0], 0, selector);
|
w0[0] = hc_byte_perm_S (w0[0], 0, selector);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 1:
|
case 1:
|
||||||
w0[3] = hc_byte_perm_S (w0[2], w0[1], selector);
|
w0[3] = hc_byte_perm_S (w0[2], w0[1], selector);
|
||||||
w0[2] = hc_byte_perm_S (w0[1], w0[0], selector);
|
w0[2] = hc_byte_perm_S (w0[1], w0[0], selector);
|
||||||
w0[1] = hc_byte_perm_S (w0[0], 0, selector);
|
w0[1] = hc_byte_perm_S (w0[0], 0, selector);
|
||||||
w0[0] = 0;
|
w0[0] = 0;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 2:
|
case 2:
|
||||||
w0[3] = hc_byte_perm_S (w0[1], w0[0], selector);
|
w0[3] = hc_byte_perm_S (w0[1], w0[0], selector);
|
||||||
w0[2] = hc_byte_perm_S (w0[0], 0, selector);
|
w0[2] = hc_byte_perm_S (w0[0], 0, selector);
|
||||||
w0[1] = 0;
|
w0[1] = 0;
|
||||||
w0[0] = 0;
|
w0[0] = 0;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 3:
|
case 3:
|
||||||
w0[3] = hc_byte_perm_S (w0[0], 0, selector);
|
w0[3] = hc_byte_perm_S (w0[0], 0, selector);
|
||||||
w0[2] = 0;
|
w0[2] = 0;
|
||||||
w0[1] = 0;
|
w0[1] = 0;
|
||||||
@ -114,19 +114,18 @@ const int offset_switch = offset / 4;
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DECLSPEC void aes256_scrt_format (PRIVATE_AS u32 *aes_ks, PRIVATE_AS u32 *pw, const u32 pw_len, PRIVATE_AS u32 *hash, PRIVATE_AS u32 *out, SHM_TYPE u32 *s_te0, SHM_TYPE u32 *s_te1, SHM_TYPE u32 *s_te2, SHM_TYPE u32 *s_te3, SHM_TYPE u32 *s_te4)
|
||||||
DECLSPEC void aes256_scrt_format (PRIVATE_AS u32 *aes_ks, PRIVATE_AS u32 *pw, const int pw_len, PRIVATE_AS u32 *hash, PRIVATE_AS u32 *out, SHM_TYPE u32 *s_te0, SHM_TYPE u32 *s_te1, SHM_TYPE u32 *s_te2, SHM_TYPE u32 *s_te3, SHM_TYPE u32 *s_te4)
|
|
||||||
{
|
{
|
||||||
AES256_set_encrypt_key(aes_ks, hash, s_te0, s_te1, s_te2, s_te3);
|
AES256_set_encrypt_key (aes_ks, hash, s_te0, s_te1, s_te2, s_te3);
|
||||||
|
|
||||||
shift_buffer_by_offset(hash,pw_len+4);
|
shift_buffer_by_offset (hash, pw_len + 4);
|
||||||
|
|
||||||
hash[0] = hc_swap32_S(pw_len);
|
hash[0] = hc_swap32_S (pw_len);
|
||||||
hash[1] |= hc_swap32_S(pw[0]);
|
hash[1] |= hc_swap32_S (pw[0]);
|
||||||
hash[2] |= hc_swap32_S(pw[1]);
|
hash[2] |= hc_swap32_S (pw[1]);
|
||||||
hash[3] |= hc_swap32_S(pw[2]);
|
hash[3] |= hc_swap32_S (pw[2]);
|
||||||
|
|
||||||
AES256_encrypt (aes_ks, hash, out, s_te0, s_te1, s_te2, s_te3, s_te4);
|
AES256_encrypt (aes_ks, hash, out, s_te0, s_te1, s_te2, s_te3, s_te4);
|
||||||
}
|
}
|
||||||
|
|
||||||
KERNEL_FQ void m31400_mxx (KERN_ATTR_BASIC ())
|
KERNEL_FQ void m31400_mxx (KERN_ATTR_BASIC ())
|
||||||
@ -137,95 +136,7 @@ KERNEL_FQ void m31400_mxx (KERN_ATTR_BASIC ())
|
|||||||
|
|
||||||
const u64 lid = get_local_id (0);
|
const u64 lid = get_local_id (0);
|
||||||
const u64 gid = get_global_id (0);
|
const u64 gid = get_global_id (0);
|
||||||
const u64 lsz = get_local_size (0);
|
const u64 lsz = get_local_size (0);
|
||||||
|
|
||||||
/**
|
|
||||||
* aes shared
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef REAL_SHM
|
|
||||||
|
|
||||||
LOCAL_VK u32 s_te0[256];
|
|
||||||
LOCAL_VK u32 s_te1[256];
|
|
||||||
LOCAL_VK u32 s_te2[256];
|
|
||||||
LOCAL_VK u32 s_te3[256];
|
|
||||||
LOCAL_VK u32 s_te4[256];
|
|
||||||
|
|
||||||
for (u32 i = lid; i < 256; i += lsz)
|
|
||||||
{
|
|
||||||
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];
|
|
||||||
}
|
|
||||||
|
|
||||||
SYNC_THREADS();
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
CONSTANT_AS u32a *s_te0 = te0;
|
|
||||||
CONSTANT_AS u32a *s_te1 = te1;
|
|
||||||
CONSTANT_AS u32a *s_te2 = te2;
|
|
||||||
CONSTANT_AS u32a *s_te3 = te3;
|
|
||||||
CONSTANT_AS u32a *s_te4 = te4;
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (gid >= GID_CNT) return;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* base
|
|
||||||
*/
|
|
||||||
|
|
||||||
sha256_ctx_t ctx0;
|
|
||||||
|
|
||||||
sha256_init (&ctx0);
|
|
||||||
|
|
||||||
sha256_update_global_swap (&ctx0, pws[gid].i, pws[gid].pw_len);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* loop
|
|
||||||
*/
|
|
||||||
|
|
||||||
u32 ks[60];
|
|
||||||
|
|
||||||
for (u32 il_pos = 0; il_pos < IL_CNT; il_pos++)
|
|
||||||
{
|
|
||||||
sha256_ctx_t ctx = ctx0;
|
|
||||||
|
|
||||||
sha256_update_global_swap (&ctx, combs_buf[il_pos].i, combs_buf[il_pos].pw_len);
|
|
||||||
|
|
||||||
u32 pw_candidate[3];
|
|
||||||
pw_candidate[0]= hc_swap32_S(ctx.w0[0]);
|
|
||||||
pw_candidate[1]= hc_swap32_S(ctx.w0[1]);
|
|
||||||
pw_candidate[2]= hc_swap32_S(ctx.w0[2]);
|
|
||||||
u32 pw_len=ctx.len;
|
|
||||||
|
|
||||||
sha256_final (&ctx);
|
|
||||||
|
|
||||||
u32 out[4]={0};
|
|
||||||
|
|
||||||
aes256_scrt_format(ks,pw_candidate,pw_len,ctx.h,out,s_te0, s_te1, s_te2, s_te3, s_te4);
|
|
||||||
|
|
||||||
const u32 r0 = out[DGST_R0];
|
|
||||||
const u32 r1 = out[DGST_R1];
|
|
||||||
const u32 r2 = out[DGST_R2];
|
|
||||||
const u32 r3 = out[DGST_R3];
|
|
||||||
|
|
||||||
COMPARE_M_SCALAR (r0, r1, r2, r3);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
KERNEL_FQ void m31400_sxx (KERN_ATTR_BASIC ())
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* modifier
|
|
||||||
*/
|
|
||||||
|
|
||||||
const u64 lid = get_local_id (0);
|
|
||||||
const u64 gid = get_global_id (0);
|
|
||||||
const u64 lsz = get_local_size (0);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* aes shared
|
* aes shared
|
||||||
@ -248,7 +159,97 @@ KERNEL_FQ void m31400_sxx (KERN_ATTR_BASIC ())
|
|||||||
s_te4[i] = te4[i];
|
s_te4[i] = te4[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
SYNC_THREADS ();
|
SYNC_THREADS();
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
CONSTANT_AS u32a *s_te0 = te0;
|
||||||
|
CONSTANT_AS u32a *s_te1 = te1;
|
||||||
|
CONSTANT_AS u32a *s_te2 = te2;
|
||||||
|
CONSTANT_AS u32a *s_te3 = te3;
|
||||||
|
CONSTANT_AS u32a *s_te4 = te4;
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (gid >= GID_CNT) return;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* base
|
||||||
|
*/
|
||||||
|
|
||||||
|
sha256_ctx_t ctx0;
|
||||||
|
|
||||||
|
sha256_init (&ctx0);
|
||||||
|
|
||||||
|
sha256_update_global_swap (&ctx0, pws[gid].i, pws[gid].pw_len);
|
||||||
|
|
||||||
|
u32 ks[60];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* loop
|
||||||
|
*/
|
||||||
|
|
||||||
|
for (u32 il_pos = 0; il_pos < IL_CNT; il_pos++)
|
||||||
|
{
|
||||||
|
sha256_ctx_t ctx = ctx0;
|
||||||
|
|
||||||
|
sha256_update_global_swap (&ctx, combs_buf[il_pos].i, combs_buf[il_pos].pw_len);
|
||||||
|
|
||||||
|
u32 pw_candidate[3];
|
||||||
|
|
||||||
|
pw_candidate[0] = hc_swap32_S (ctx.w0[0]);
|
||||||
|
pw_candidate[1] = hc_swap32_S (ctx.w0[1]);
|
||||||
|
pw_candidate[2] = hc_swap32_S (ctx.w0[2]);
|
||||||
|
|
||||||
|
u32 pw_len=ctx.len;
|
||||||
|
|
||||||
|
sha256_final (&ctx);
|
||||||
|
|
||||||
|
u32 out[4] = { 0 };
|
||||||
|
|
||||||
|
aes256_scrt_format (ks, pw_candidate, pw_len, ctx.h, out, s_te0, s_te1, s_te2, s_te3, s_te4);
|
||||||
|
|
||||||
|
const u32 r0 = out[DGST_R0];
|
||||||
|
const u32 r1 = out[DGST_R1];
|
||||||
|
const u32 r2 = out[DGST_R2];
|
||||||
|
const u32 r3 = out[DGST_R3];
|
||||||
|
|
||||||
|
COMPARE_M_SCALAR (r0, r1, r2, r3);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
KERNEL_FQ void m31400_sxx (KERN_ATTR_BASIC ())
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* modifier
|
||||||
|
*/
|
||||||
|
|
||||||
|
const u64 lid = get_local_id (0);
|
||||||
|
const u64 gid = get_global_id (0);
|
||||||
|
const u64 lsz = get_local_size (0);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* aes shared
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef REAL_SHM
|
||||||
|
|
||||||
|
LOCAL_VK u32 s_te0[256];
|
||||||
|
LOCAL_VK u32 s_te1[256];
|
||||||
|
LOCAL_VK u32 s_te2[256];
|
||||||
|
LOCAL_VK u32 s_te3[256];
|
||||||
|
LOCAL_VK u32 s_te4[256];
|
||||||
|
|
||||||
|
for (u32 i = lid; i < 256; i += lsz)
|
||||||
|
{
|
||||||
|
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];
|
||||||
|
}
|
||||||
|
|
||||||
|
SYNC_THREADS();
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
@ -295,18 +296,20 @@ KERNEL_FQ void m31400_sxx (KERN_ATTR_BASIC ())
|
|||||||
sha256_ctx_t ctx = ctx0;
|
sha256_ctx_t ctx = ctx0;
|
||||||
|
|
||||||
sha256_update_global_swap (&ctx, combs_buf[il_pos].i, combs_buf[il_pos].pw_len);
|
sha256_update_global_swap (&ctx, combs_buf[il_pos].i, combs_buf[il_pos].pw_len);
|
||||||
|
|
||||||
u32 pw_candidate[3];
|
u32 pw_candidate[3];
|
||||||
pw_candidate[0]=hc_swap32_S(ctx.w0[0]);
|
|
||||||
pw_candidate[1]=hc_swap32_S(ctx.w0[1]);
|
pw_candidate[0] = hc_swap32_S (ctx.w0[0]);
|
||||||
pw_candidate[2]=hc_swap32_S(ctx.w0[2]);
|
pw_candidate[1] = hc_swap32_S (ctx.w0[1]);
|
||||||
|
pw_candidate[2] = hc_swap32_S (ctx.w0[2]);
|
||||||
|
|
||||||
u32 pw_len=ctx.len;
|
u32 pw_len=ctx.len;
|
||||||
|
|
||||||
sha256_final (&ctx);
|
sha256_final (&ctx);
|
||||||
|
|
||||||
u32 out[4]={0};
|
u32 out[4] = { 0 };
|
||||||
|
|
||||||
aes256_scrt_format(ks,pw_candidate,pw_len,ctx.h,out,s_te0, s_te1, s_te2, s_te3, s_te4);
|
aes256_scrt_format (ks, pw_candidate, pw_len, ctx.h, out, s_te0, s_te1, s_te2, s_te3, s_te4);
|
||||||
|
|
||||||
const u32 r0 = out[DGST_R0];
|
const u32 r0 = out[DGST_R0];
|
||||||
const u32 r1 = out[DGST_R1];
|
const u32 r1 = out[DGST_R1];
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -20,6 +20,7 @@
|
|||||||
- Added hash-mode: GPG (AES-128/AES-256 (SHA-256($pass)))
|
- Added hash-mode: GPG (AES-128/AES-256 (SHA-256($pass)))
|
||||||
- Added hash-mode: GPG (AES-128/AES-256 (SHA-512($pass)))
|
- Added hash-mode: GPG (AES-128/AES-256 (SHA-512($pass)))
|
||||||
- Added hash-mode: MetaMask Wallet (short hash, plaintext check)
|
- Added hash-mode: MetaMask Wallet (short hash, plaintext check)
|
||||||
|
- Added hash-mode: SecureCRT MasterPassphrase v2
|
||||||
- Added hash-mode: Veeam VB
|
- Added hash-mode: Veeam VB
|
||||||
- Added hash-mode: bcrypt(sha256($pass))
|
- Added hash-mode: bcrypt(sha256($pass))
|
||||||
- Added hash-mode: HMAC-RIPEMD160 (key = $pass)
|
- Added hash-mode: HMAC-RIPEMD160 (key = $pass)
|
||||||
|
@ -18,7 +18,7 @@ static const u32 DGST_POS0 = 0;
|
|||||||
static const u32 DGST_POS1 = 1;
|
static const u32 DGST_POS1 = 1;
|
||||||
static const u32 DGST_POS2 = 2;
|
static const u32 DGST_POS2 = 2;
|
||||||
static const u32 DGST_POS3 = 3;
|
static const u32 DGST_POS3 = 3;
|
||||||
static const u32 DGST_SIZE = DGST_SIZE_4_8;
|
static const u32 DGST_SIZE = DGST_SIZE_4_4;
|
||||||
static const u32 HASH_CATEGORY = HASH_CATEGORY_RAW_HASH;
|
static const u32 HASH_CATEGORY = HASH_CATEGORY_RAW_HASH;
|
||||||
static const char *HASH_NAME = "SecureCRT MasterPassphrase v2";
|
static const char *HASH_NAME = "SecureCRT MasterPassphrase v2";
|
||||||
static const u64 KERN_TYPE = 31400;
|
static const u64 KERN_TYPE = 31400;
|
||||||
@ -53,7 +53,7 @@ const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig,
|
|||||||
|
|
||||||
int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len)
|
int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len)
|
||||||
{
|
{
|
||||||
static const char *CONFIGPASSPHRASEV2_SIGNATURE = "S:\"Config Passphrase\"=02:"; //The whole line is part of the format to prevent confusion with other similiar tokens also prefixed with 02: in the config files
|
static const char *CONFIGPASSPHRASEV2_SIGNATURE = "S:\"Config Passphrase\"=02:"; //The whole line is part of the format to prevent confusion with other similiar tokens also prefixed with 02: in the config files
|
||||||
static const char *CONFIGPASSPHRASEV2_SIGNATURE_UNDERSCORE = "S:_Config_Passphrase_=02:"; //double quotes char messes up testing so we're also allowing underscore instead
|
static const char *CONFIGPASSPHRASEV2_SIGNATURE_UNDERSCORE = "S:_Config_Passphrase_=02:"; //double quotes char messes up testing so we're also allowing underscore instead
|
||||||
|
|
||||||
u32 *digest = (u32 *) digest_buf;
|
u32 *digest = (u32 *) digest_buf;
|
||||||
|
Loading…
Reference in New Issue
Block a user