mirror of
https://github.com/hashcat/hashcat
synced 2024-12-01 20:18:12 +01:00
RAR3-hp Plugin: Replaced naive with true UTF8 to UTF16 conversion in optimized and pure kernel
This commit is contained in:
parent
086660e907
commit
23bbe457a0
@ -54,15 +54,20 @@ KERNEL_FQ void m12500_loop (KERN_ATTR_TMPS (rar3_tmp_t))
|
|||||||
|
|
||||||
if (gid >= gid_max) return;
|
if (gid >= gid_max) return;
|
||||||
|
|
||||||
u32 pw_buf[5];
|
u32 pw_buf[10];
|
||||||
|
|
||||||
pw_buf[0] = pws[gid].i[0];
|
pw_buf[0] = pws[gid].i[0];
|
||||||
pw_buf[1] = pws[gid].i[1];
|
pw_buf[1] = pws[gid].i[1];
|
||||||
pw_buf[2] = pws[gid].i[2];
|
pw_buf[2] = pws[gid].i[2];
|
||||||
pw_buf[3] = pws[gid].i[3];
|
pw_buf[3] = pws[gid].i[3];
|
||||||
pw_buf[4] = pws[gid].i[4];
|
pw_buf[4] = pws[gid].i[4];
|
||||||
|
pw_buf[5] = pws[gid].i[5];
|
||||||
|
pw_buf[6] = pws[gid].i[6];
|
||||||
|
pw_buf[7] = pws[gid].i[7];
|
||||||
|
pw_buf[8] = pws[gid].i[8];
|
||||||
|
pw_buf[9] = pws[gid].i[9];
|
||||||
|
|
||||||
const u32 pw_len = MIN (pws[gid].pw_len, 20);
|
const u32 pw_len = MIN (pws[gid].pw_len, 40);
|
||||||
|
|
||||||
u32 salt_buf[2];
|
u32 salt_buf[2];
|
||||||
|
|
||||||
@ -81,7 +86,7 @@ KERNEL_FQ void m12500_loop (KERN_ATTR_TMPS (rar3_tmp_t))
|
|||||||
|
|
||||||
for (u32 i = 0, p = 0; i < 64; i++)
|
for (u32 i = 0, p = 0; i < 64; i++)
|
||||||
{
|
{
|
||||||
for (u32 j = 0; j < pw_len; j++, p += 2)
|
for (u32 j = 0; j < pw_len; j++, p += 1)
|
||||||
{
|
{
|
||||||
PUTCHAR_BE (largeblock, p, GETCHAR (pw_buf, j));
|
PUTCHAR_BE (largeblock, p, GETCHAR (pw_buf, j));
|
||||||
}
|
}
|
||||||
@ -96,9 +101,9 @@ KERNEL_FQ void m12500_loop (KERN_ATTR_TMPS (rar3_tmp_t))
|
|||||||
p += 3;
|
p += 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
const u32 p2 = (pw_len * 2) + salt_len;
|
const u32 p2 = pw_len + salt_len;
|
||||||
|
|
||||||
const u32 p3 = (pw_len * 2) + salt_len + 3;
|
const u32 p3 = pw_len + salt_len + 3;
|
||||||
|
|
||||||
const u32 init_pos = loop_pos / (ROUNDS / 16);
|
const u32 init_pos = loop_pos / (ROUNDS / 16);
|
||||||
|
|
||||||
@ -295,11 +300,11 @@ KERNEL_FQ void m12500_comp (KERN_ATTR_TMPS (rar3_tmp_t))
|
|||||||
* base
|
* base
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const u32 pw_len = MIN (pws[gid].pw_len, 20);
|
const u32 pw_len = MIN (pws[gid].pw_len, 40);
|
||||||
|
|
||||||
const u32 salt_len = 8;
|
const u32 salt_len = 8;
|
||||||
|
|
||||||
const u32 p3 = (pw_len * 2) + salt_len + 3;
|
const u32 p3 = pw_len + salt_len + 3;
|
||||||
|
|
||||||
u32 w0[4];
|
u32 w0[4];
|
||||||
u32 w1[4];
|
u32 w1[4];
|
||||||
@ -364,13 +369,18 @@ KERNEL_FQ void m12500_comp (KERN_ATTR_TMPS (rar3_tmp_t))
|
|||||||
|
|
||||||
for (int i = 0; i < 16; i++)
|
for (int i = 0; i < 16; i++)
|
||||||
{
|
{
|
||||||
u32 pw_buf[5];
|
u32 pw_buf[10];
|
||||||
|
|
||||||
pw_buf[0] = pws[gid].i[0];
|
pw_buf[0] = pws[gid].i[0];
|
||||||
pw_buf[1] = pws[gid].i[1];
|
pw_buf[1] = pws[gid].i[1];
|
||||||
pw_buf[2] = pws[gid].i[2];
|
pw_buf[2] = pws[gid].i[2];
|
||||||
pw_buf[3] = pws[gid].i[3];
|
pw_buf[3] = pws[gid].i[3];
|
||||||
pw_buf[4] = pws[gid].i[4];
|
pw_buf[4] = pws[gid].i[4];
|
||||||
|
pw_buf[5] = pws[gid].i[5];
|
||||||
|
pw_buf[6] = pws[gid].i[6];
|
||||||
|
pw_buf[7] = pws[gid].i[7];
|
||||||
|
pw_buf[8] = pws[gid].i[8];
|
||||||
|
pw_buf[9] = pws[gid].i[9];
|
||||||
|
|
||||||
//const u32 pw_len = pws[gid].pw_len;
|
//const u32 pw_len = pws[gid].pw_len;
|
||||||
|
|
||||||
@ -381,7 +391,7 @@ KERNEL_FQ void m12500_comp (KERN_ATTR_TMPS (rar3_tmp_t))
|
|||||||
|
|
||||||
//const u32 salt_len = 8;
|
//const u32 salt_len = 8;
|
||||||
|
|
||||||
//const u32 p3 = (pw_len * 2) + salt_len + 3;
|
//const u32 p3 = pw_len + salt_len + 3;
|
||||||
|
|
||||||
u32 w[16];
|
u32 w[16];
|
||||||
|
|
||||||
@ -404,7 +414,7 @@ KERNEL_FQ void m12500_comp (KERN_ATTR_TMPS (rar3_tmp_t))
|
|||||||
|
|
||||||
u32 p = 0;
|
u32 p = 0;
|
||||||
|
|
||||||
for (u32 j = 0; j < pw_len; j++, p += 2)
|
for (u32 j = 0; j < pw_len; j++, p += 1)
|
||||||
{
|
{
|
||||||
PUTCHAR_BE (w, p, GETCHAR (pw_buf, j));
|
PUTCHAR_BE (w, p, GETCHAR (pw_buf, j));
|
||||||
}
|
}
|
||||||
|
@ -741,38 +741,17 @@ KERNEL_FQ void m12500_init (KERN_ATTR_TMPS (rar3_tmp_t))
|
|||||||
|
|
||||||
const u32 pw_len = pws[gid].pw_len;
|
const u32 pw_len = pws[gid].pw_len;
|
||||||
|
|
||||||
// first set the utf16le pass:
|
|
||||||
|
|
||||||
u32 w[80] = { 0 };
|
u32 w[80] = { 0 };
|
||||||
|
|
||||||
for (u32 i = 0, j = 0, k = 0; i < pw_len; i += 16, j += 4, k += 8)
|
for (int i = 0, j = 0; i < pw_len; i += 4, j += 1)
|
||||||
{
|
{
|
||||||
u32 a[4];
|
w[j] = hc_swap32_S (pws[gid].i[j]);
|
||||||
|
|
||||||
a[0] = pws[gid].i[j + 0];
|
|
||||||
a[1] = pws[gid].i[j + 1];
|
|
||||||
a[2] = pws[gid].i[j + 2];
|
|
||||||
a[3] = pws[gid].i[j + 3];
|
|
||||||
|
|
||||||
u32 b[4];
|
|
||||||
u32 c[4];
|
|
||||||
|
|
||||||
make_utf16le (a, b, c);
|
|
||||||
|
|
||||||
w[k + 0] = hc_swap32_S (b[0]);
|
|
||||||
w[k + 1] = hc_swap32_S (b[1]);
|
|
||||||
w[k + 2] = hc_swap32_S (b[2]);
|
|
||||||
w[k + 3] = hc_swap32_S (b[3]);
|
|
||||||
w[k + 4] = hc_swap32_S (c[0]);
|
|
||||||
w[k + 5] = hc_swap32_S (c[1]);
|
|
||||||
w[k + 6] = hc_swap32_S (c[2]);
|
|
||||||
w[k + 7] = hc_swap32_S (c[3]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// append salt:
|
// append salt:
|
||||||
|
|
||||||
const u32 salt_idx = (pw_len * 2) / 4;
|
const u32 salt_idx = pw_len / 4;
|
||||||
const u32 salt_off = (pw_len * 2) & 3;
|
const u32 salt_off = pw_len & 3;
|
||||||
|
|
||||||
u32 salt_buf[3];
|
u32 salt_buf[3];
|
||||||
|
|
||||||
@ -789,8 +768,7 @@ KERNEL_FQ void m12500_init (KERN_ATTR_TMPS (rar3_tmp_t))
|
|||||||
salt_buf[0] = (salt_buf[0] >> 16);
|
salt_buf[0] = (salt_buf[0] >> 16);
|
||||||
}
|
}
|
||||||
|
|
||||||
w[salt_idx] |= salt_buf[0];
|
w[salt_idx + 0] |= salt_buf[0];
|
||||||
|
|
||||||
w[salt_idx + 1] = salt_buf[1];
|
w[salt_idx + 1] = salt_buf[1];
|
||||||
w[salt_idx + 2] = salt_buf[2];
|
w[salt_idx + 2] = salt_buf[2];
|
||||||
|
|
||||||
@ -819,17 +797,17 @@ KERNEL_FQ void m12500_loop (KERN_ATTR_TMPS (rar3_tmp_t))
|
|||||||
* base
|
* base
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const u32 pw_len = pws[gid].pw_len;
|
const u32 pw_len = pws[gid].pw_len & 255;
|
||||||
|
|
||||||
const u32 salt_len = 8;
|
const u32 salt_len = 8;
|
||||||
|
|
||||||
const u32 pw_salt_len = (pw_len * 2) + salt_len;
|
const u32 pw_salt_len = pw_len + salt_len;
|
||||||
|
|
||||||
const u32 p3 = pw_salt_len + 3;
|
const u32 p3 = pw_salt_len + 3;
|
||||||
|
|
||||||
u32 w[80] = { 0 }; // 64 byte aligned
|
u32 w[80] = { 0 };
|
||||||
|
|
||||||
for (u32 i = 0; i < 66; i++) // unroll ?
|
for (u32 i = 0; i < 66; i++)
|
||||||
{
|
{
|
||||||
w[i] = tmps[gid].w[i];
|
w[i] = tmps[gid].w[i];
|
||||||
}
|
}
|
||||||
@ -856,7 +834,6 @@ KERNEL_FQ void m12500_loop (KERN_ATTR_TMPS (rar3_tmp_t))
|
|||||||
|
|
||||||
ctx_iv.len += 3;
|
ctx_iv.len += 3;
|
||||||
|
|
||||||
|
|
||||||
// copy the context from ctx_iv to ctx:
|
// copy the context from ctx_iv to ctx:
|
||||||
|
|
||||||
sha1_ctx_t ctx;
|
sha1_ctx_t ctx;
|
||||||
@ -917,7 +894,7 @@ KERNEL_FQ void m12500_loop (KERN_ATTR_TMPS (rar3_tmp_t))
|
|||||||
|
|
||||||
// only needed if pw_len > 28:
|
// only needed if pw_len > 28:
|
||||||
|
|
||||||
for (u32 i = 0; i < 66; i++) // unroll ?
|
for (u32 i = 0; i < 66; i++)
|
||||||
{
|
{
|
||||||
tmps[gid].w[i] = w[i];
|
tmps[gid].w[i] = w[i];
|
||||||
}
|
}
|
||||||
@ -986,11 +963,11 @@ KERNEL_FQ void m12500_comp (KERN_ATTR_TMPS (rar3_tmp_t))
|
|||||||
* base
|
* base
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const u32 pw_len = pws[gid].pw_len;
|
const u32 pw_len = pws[gid].pw_len & 255;
|
||||||
|
|
||||||
const u32 salt_len = 8;
|
const u32 salt_len = 8;
|
||||||
|
|
||||||
const u32 pw_salt_len = (pw_len * 2) + salt_len;
|
const u32 pw_salt_len = pw_len + salt_len;
|
||||||
|
|
||||||
const u32 p3 = pw_salt_len + 3;
|
const u32 p3 = pw_salt_len + 3;
|
||||||
|
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
- CUDA Backend: Do not warn about missing CUDA SDK installation if --stdout is used
|
- CUDA Backend: Do not warn about missing CUDA SDK installation if --stdout is used
|
||||||
- Performance Monitor: Add -S as a user suggestion to improve cracking performance in specific attack configurations
|
- Performance Monitor: Add -S as a user suggestion to improve cracking performance in specific attack configurations
|
||||||
- Status Screen: Show currently running kernel type (pure, optimized) and generator type (host, device)
|
- Status Screen: Show currently running kernel type (pure, optimized) and generator type (host, device)
|
||||||
|
- RAR3-hp Plugin: Replaced naive with true UTF8 to UTF16 conversion in optimized and pure kernel
|
||||||
|
|
||||||
##
|
##
|
||||||
## Technical
|
## Technical
|
||||||
|
@ -20,7 +20,8 @@ static const u32 HASH_CATEGORY = HASH_CATEGORY_ARCHIVE;
|
|||||||
static const char *HASH_NAME = "RAR3-hp";
|
static const char *HASH_NAME = "RAR3-hp";
|
||||||
static const u64 KERN_TYPE = 12500;
|
static const u64 KERN_TYPE = 12500;
|
||||||
static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE;
|
static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE;
|
||||||
static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE;
|
static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE
|
||||||
|
| OPTS_TYPE_POST_AMP_UTF16LE;
|
||||||
static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED;
|
static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED;
|
||||||
static const char *ST_PASS = "hashcat";
|
static const char *ST_PASS = "hashcat";
|
||||||
static const char *ST_HASH = "$RAR3$*0*45109af8ab5f297a*adbf6c5385d7a40373e8f77d7b89d317";
|
static const char *ST_HASH = "$RAR3$*0*45109af8ab5f297a*adbf6c5385d7a40373e8f77d7b89d317";
|
||||||
@ -100,7 +101,7 @@ u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED con
|
|||||||
{
|
{
|
||||||
const bool optimized_kernel = (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL);
|
const bool optimized_kernel = (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL);
|
||||||
|
|
||||||
u32 pw_max = 127;
|
u32 pw_max = 64;
|
||||||
|
|
||||||
if (optimized_kernel == true)
|
if (optimized_kernel == true)
|
||||||
{
|
{
|
||||||
@ -112,7 +113,7 @@ u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED con
|
|||||||
|
|
||||||
const char *module_benchmark_mask (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra)
|
const char *module_benchmark_mask (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra)
|
||||||
{
|
{
|
||||||
const char *mask = "?b?b?b?b?b";
|
const char *mask = "?l?l?l?l?l";
|
||||||
|
|
||||||
return mask;
|
return mask;
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,7 @@ use Digest::SHA;
|
|||||||
use Crypt::CBC;
|
use Crypt::CBC;
|
||||||
use Encode;
|
use Encode;
|
||||||
|
|
||||||
sub module_constraints { [[0, 127], [8, 8], [0, 20], [8, 8], [-1, -1]] }
|
sub module_constraints { [[0, 64], [8, 8], [0, 20], [8, 8], [-1, -1]] }
|
||||||
|
|
||||||
my $ITERATIONS = 0x40000;
|
my $ITERATIONS = 0x40000;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user