mirror of
https://github.com/hashcat/hashcat.git
synced 2024-11-23 00:28:11 +00:00
Optimized -m 8300 (DNSSEC) cracking performance in -a 3 mode
This commit is contained in:
parent
99524ce27f
commit
0f73c778d5
@ -166,35 +166,31 @@ static void m08300m (u32 w0[4], u32 w1[4], u32 w2[4], u32 w3[4], const u32 pw_le
|
||||
u32 salt_buf0[4];
|
||||
u32 salt_buf1[4];
|
||||
|
||||
salt_buf0[0] = salt_bufs[salt_pos].salt_buf[ 0];
|
||||
salt_buf0[1] = salt_bufs[salt_pos].salt_buf[ 1];
|
||||
salt_buf0[2] = salt_bufs[salt_pos].salt_buf[ 2];
|
||||
salt_buf0[3] = salt_bufs[salt_pos].salt_buf[ 3];
|
||||
salt_buf1[0] = salt_bufs[salt_pos].salt_buf[ 4];
|
||||
salt_buf1[1] = salt_bufs[salt_pos].salt_buf[ 5];
|
||||
salt_buf1[2] = salt_bufs[salt_pos].salt_buf[ 6];
|
||||
salt_buf1[3] = salt_bufs[salt_pos].salt_buf[ 7];
|
||||
salt_buf0[0] = swap32_S (salt_bufs[salt_pos].salt_buf[ 0]);
|
||||
salt_buf0[1] = swap32_S (salt_bufs[salt_pos].salt_buf[ 1]);
|
||||
salt_buf0[2] = swap32_S (salt_bufs[salt_pos].salt_buf[ 2]);
|
||||
salt_buf0[3] = swap32_S (salt_bufs[salt_pos].salt_buf[ 3]);
|
||||
salt_buf1[0] = swap32_S (salt_bufs[salt_pos].salt_buf[ 4]);
|
||||
salt_buf1[1] = swap32_S (salt_bufs[salt_pos].salt_buf[ 5]);
|
||||
salt_buf1[2] = swap32_S (salt_bufs[salt_pos].salt_buf[ 6]);
|
||||
salt_buf1[3] = swap32_S (salt_bufs[salt_pos].salt_buf[ 7]);
|
||||
|
||||
const u32 salt_len = salt_bufs[salt_pos].salt_len;
|
||||
|
||||
u32 domain_buf0[4];
|
||||
u32 domain_buf1[4];
|
||||
|
||||
domain_buf0[0] = salt_bufs[salt_pos].salt_buf_pc[ 0];
|
||||
domain_buf0[1] = salt_bufs[salt_pos].salt_buf_pc[ 1];
|
||||
domain_buf0[2] = salt_bufs[salt_pos].salt_buf_pc[ 2];
|
||||
domain_buf0[3] = salt_bufs[salt_pos].salt_buf_pc[ 3];
|
||||
domain_buf1[0] = salt_bufs[salt_pos].salt_buf_pc[ 4];
|
||||
domain_buf1[1] = salt_bufs[salt_pos].salt_buf_pc[ 5];
|
||||
domain_buf1[2] = salt_bufs[salt_pos].salt_buf_pc[ 6];
|
||||
domain_buf0[0] = swap32_S (salt_bufs[salt_pos].salt_buf_pc[ 0]);
|
||||
domain_buf0[1] = swap32_S (salt_bufs[salt_pos].salt_buf_pc[ 1]);
|
||||
domain_buf0[2] = swap32_S (salt_bufs[salt_pos].salt_buf_pc[ 2]);
|
||||
domain_buf0[3] = swap32_S (salt_bufs[salt_pos].salt_buf_pc[ 3]);
|
||||
domain_buf1[0] = swap32_S (salt_bufs[salt_pos].salt_buf_pc[ 4]);
|
||||
domain_buf1[1] = swap32_S (salt_bufs[salt_pos].salt_buf_pc[ 5]);
|
||||
domain_buf1[2] = swap32_S (salt_bufs[salt_pos].salt_buf_pc[ 6]);
|
||||
domain_buf1[3] = 0;
|
||||
|
||||
const u32 domain_len = salt_bufs[salt_pos].salt_buf_pc[ 7];
|
||||
|
||||
/**
|
||||
* salt
|
||||
*/
|
||||
|
||||
u32 s0[4];
|
||||
u32 s1[4];
|
||||
u32 s2[4];
|
||||
@ -217,7 +213,7 @@ static void m08300m (u32 w0[4], u32 w1[4], u32 w2[4], u32 w3[4], const u32 pw_le
|
||||
s3[2] = 0;
|
||||
s3[3] = 0;
|
||||
|
||||
switch_buffer_by_offset_le_S (s0, s1, s2, s3, pw_len);
|
||||
switch_buffer_by_offset_be_S (s0, s1, s2, s3, pw_len);
|
||||
|
||||
w0[0] |= s0[0];
|
||||
w0[1] |= s0[1];
|
||||
@ -253,7 +249,7 @@ static void m08300m (u32 w0[4], u32 w1[4], u32 w2[4], u32 w3[4], const u32 pw_le
|
||||
s3[2] = 0;
|
||||
s3[3] = 0;
|
||||
|
||||
switch_buffer_by_offset_le_S (s0, s1, s2, s3, pw_len + domain_len + 1);
|
||||
switch_buffer_by_offset_be_S (s0, s1, s2, s3, pw_len + domain_len + 1);
|
||||
|
||||
w0[0] |= s0[0];
|
||||
w0[1] |= s0[1];
|
||||
@ -306,31 +302,16 @@ static void m08300m (u32 w0[4], u32 w1[4], u32 w2[4], u32 w3[4], const u32 pw_le
|
||||
w3_t[2] = w3[2];
|
||||
w3_t[3] = w3[3];
|
||||
|
||||
switch_buffer_by_offset_le (w0_t, w1_t, w2_t, w3_t, 1);
|
||||
switch_buffer_by_offset_be (w0_t, w1_t, w2_t, w3_t, 1);
|
||||
|
||||
w0_t[0] |= pw_len & 0xff;
|
||||
w0_t[0] |= (pw_len & 0xff) << 24;
|
||||
w3_t[2] = 0;
|
||||
w3_t[3] = (1 + pw_len + domain_len + 1 + salt_len) * 8;
|
||||
|
||||
/**
|
||||
* sha1
|
||||
*/
|
||||
|
||||
w0_t[0] = swap32 (w0_t[0]);
|
||||
w0_t[1] = swap32 (w0_t[1]);
|
||||
w0_t[2] = swap32 (w0_t[2]);
|
||||
w0_t[3] = swap32 (w0_t[3]);
|
||||
w1_t[0] = swap32 (w1_t[0]);
|
||||
w1_t[1] = swap32 (w1_t[1]);
|
||||
w1_t[2] = swap32 (w1_t[2]);
|
||||
w1_t[3] = swap32 (w1_t[3]);
|
||||
w2_t[0] = swap32 (w2_t[0]);
|
||||
w2_t[1] = swap32 (w2_t[1]);
|
||||
w2_t[2] = swap32 (w2_t[2]);
|
||||
w2_t[3] = swap32 (w2_t[3]);
|
||||
w3_t[0] = swap32 (w3_t[0]);
|
||||
w3_t[1] = swap32 (w3_t[1]);
|
||||
w3_t[2] = 0;
|
||||
w3_t[3] = (1 + pw_len + domain_len + 1 + salt_len) * 8;
|
||||
|
||||
u32x digest[5];
|
||||
|
||||
digest[0] = SHA1M_A;
|
||||
@ -350,14 +331,14 @@ static void m08300m (u32 w0[4], u32 w1[4], u32 w2[4], u32 w3[4], const u32 pw_le
|
||||
w0_t[2] = digest[2];
|
||||
w0_t[3] = digest[3];
|
||||
w1_t[0] = digest[4];
|
||||
w1_t[1] = swap32 (salt_buf0[0]);
|
||||
w1_t[2] = swap32 (salt_buf0[1]);
|
||||
w1_t[3] = swap32 (salt_buf0[2]);
|
||||
w2_t[0] = swap32 (salt_buf0[3]);
|
||||
w2_t[1] = swap32 (salt_buf1[0]);
|
||||
w2_t[2] = swap32 (salt_buf1[1]);
|
||||
w2_t[3] = swap32 (salt_buf1[2]);
|
||||
w3_t[0] = swap32 (salt_buf1[3]);
|
||||
w1_t[1] = salt_buf0[0];
|
||||
w1_t[2] = salt_buf0[1];
|
||||
w1_t[3] = salt_buf0[2];
|
||||
w2_t[0] = salt_buf0[3];
|
||||
w2_t[1] = salt_buf1[0];
|
||||
w2_t[2] = salt_buf1[1];
|
||||
w2_t[3] = salt_buf1[2];
|
||||
w3_t[0] = salt_buf1[3];
|
||||
w3_t[1] = 0;
|
||||
w3_t[2] = 0;
|
||||
w3_t[3] = (20 + salt_len) * 8;
|
||||
@ -384,18 +365,6 @@ static void m08300s (u32 w0[4], u32 w1[4], u32 w2[4], u32 w3[4], const u32 pw_le
|
||||
const u32 gid = get_global_id (0);
|
||||
const u32 lid = get_local_id (0);
|
||||
|
||||
/**
|
||||
* digest
|
||||
*/
|
||||
|
||||
const u32 search[4] =
|
||||
{
|
||||
digests_buf[digests_offset].digest_buf[DGST_R0],
|
||||
digests_buf[digests_offset].digest_buf[DGST_R1],
|
||||
digests_buf[digests_offset].digest_buf[DGST_R2],
|
||||
digests_buf[digests_offset].digest_buf[DGST_R3]
|
||||
};
|
||||
|
||||
/**
|
||||
* salt
|
||||
*/
|
||||
@ -405,35 +374,31 @@ static void m08300s (u32 w0[4], u32 w1[4], u32 w2[4], u32 w3[4], const u32 pw_le
|
||||
u32 salt_buf0[4];
|
||||
u32 salt_buf1[4];
|
||||
|
||||
salt_buf0[0] = salt_bufs[salt_pos].salt_buf[ 0];
|
||||
salt_buf0[1] = salt_bufs[salt_pos].salt_buf[ 1];
|
||||
salt_buf0[2] = salt_bufs[salt_pos].salt_buf[ 2];
|
||||
salt_buf0[3] = salt_bufs[salt_pos].salt_buf[ 3];
|
||||
salt_buf1[0] = salt_bufs[salt_pos].salt_buf[ 4];
|
||||
salt_buf1[1] = salt_bufs[salt_pos].salt_buf[ 5];
|
||||
salt_buf1[2] = salt_bufs[salt_pos].salt_buf[ 6];
|
||||
salt_buf1[3] = salt_bufs[salt_pos].salt_buf[ 7];
|
||||
salt_buf0[0] = swap32_S (salt_bufs[salt_pos].salt_buf[ 0]);
|
||||
salt_buf0[1] = swap32_S (salt_bufs[salt_pos].salt_buf[ 1]);
|
||||
salt_buf0[2] = swap32_S (salt_bufs[salt_pos].salt_buf[ 2]);
|
||||
salt_buf0[3] = swap32_S (salt_bufs[salt_pos].salt_buf[ 3]);
|
||||
salt_buf1[0] = swap32_S (salt_bufs[salt_pos].salt_buf[ 4]);
|
||||
salt_buf1[1] = swap32_S (salt_bufs[salt_pos].salt_buf[ 5]);
|
||||
salt_buf1[2] = swap32_S (salt_bufs[salt_pos].salt_buf[ 6]);
|
||||
salt_buf1[3] = swap32_S (salt_bufs[salt_pos].salt_buf[ 7]);
|
||||
|
||||
const u32 salt_len = salt_bufs[salt_pos].salt_len;
|
||||
|
||||
u32 domain_buf0[4];
|
||||
u32 domain_buf1[4];
|
||||
|
||||
domain_buf0[0] = salt_bufs[salt_pos].salt_buf_pc[ 0];
|
||||
domain_buf0[1] = salt_bufs[salt_pos].salt_buf_pc[ 1];
|
||||
domain_buf0[2] = salt_bufs[salt_pos].salt_buf_pc[ 2];
|
||||
domain_buf0[3] = salt_bufs[salt_pos].salt_buf_pc[ 3];
|
||||
domain_buf1[0] = salt_bufs[salt_pos].salt_buf_pc[ 4];
|
||||
domain_buf1[1] = salt_bufs[salt_pos].salt_buf_pc[ 5];
|
||||
domain_buf1[2] = salt_bufs[salt_pos].salt_buf_pc[ 6];
|
||||
domain_buf0[0] = swap32_S (salt_bufs[salt_pos].salt_buf_pc[ 0]);
|
||||
domain_buf0[1] = swap32_S (salt_bufs[salt_pos].salt_buf_pc[ 1]);
|
||||
domain_buf0[2] = swap32_S (salt_bufs[salt_pos].salt_buf_pc[ 2]);
|
||||
domain_buf0[3] = swap32_S (salt_bufs[salt_pos].salt_buf_pc[ 3]);
|
||||
domain_buf1[0] = swap32_S (salt_bufs[salt_pos].salt_buf_pc[ 4]);
|
||||
domain_buf1[1] = swap32_S (salt_bufs[salt_pos].salt_buf_pc[ 5]);
|
||||
domain_buf1[2] = swap32_S (salt_bufs[salt_pos].salt_buf_pc[ 6]);
|
||||
domain_buf1[3] = 0;
|
||||
|
||||
const u32 domain_len = salt_bufs[salt_pos].salt_buf_pc[ 7];
|
||||
|
||||
/**
|
||||
* salt
|
||||
*/
|
||||
|
||||
u32 s0[4];
|
||||
u32 s1[4];
|
||||
u32 s2[4];
|
||||
@ -456,7 +421,7 @@ static void m08300s (u32 w0[4], u32 w1[4], u32 w2[4], u32 w3[4], const u32 pw_le
|
||||
s3[2] = 0;
|
||||
s3[3] = 0;
|
||||
|
||||
switch_buffer_by_offset_le_S (s0, s1, s2, s3, pw_len);
|
||||
switch_buffer_by_offset_be_S (s0, s1, s2, s3, pw_len);
|
||||
|
||||
w0[0] |= s0[0];
|
||||
w0[1] |= s0[1];
|
||||
@ -492,7 +457,7 @@ static void m08300s (u32 w0[4], u32 w1[4], u32 w2[4], u32 w3[4], const u32 pw_le
|
||||
s3[2] = 0;
|
||||
s3[3] = 0;
|
||||
|
||||
switch_buffer_by_offset_le_S (s0, s1, s2, s3, pw_len + domain_len + 1);
|
||||
switch_buffer_by_offset_be_S (s0, s1, s2, s3, pw_len + domain_len + 1);
|
||||
|
||||
w0[0] |= s0[0];
|
||||
w0[1] |= s0[1];
|
||||
@ -511,6 +476,18 @@ static void m08300s (u32 w0[4], u32 w1[4], u32 w2[4], u32 w3[4], const u32 pw_le
|
||||
w3[2] |= s3[2];
|
||||
w3[3] |= s3[3];
|
||||
|
||||
/**
|
||||
* digest
|
||||
*/
|
||||
|
||||
const u32 search[4] =
|
||||
{
|
||||
digests_buf[digests_offset].digest_buf[DGST_R0],
|
||||
digests_buf[digests_offset].digest_buf[DGST_R1],
|
||||
digests_buf[digests_offset].digest_buf[DGST_R2],
|
||||
digests_buf[digests_offset].digest_buf[DGST_R3]
|
||||
};
|
||||
|
||||
/**
|
||||
* loop
|
||||
*/
|
||||
@ -545,31 +522,16 @@ static void m08300s (u32 w0[4], u32 w1[4], u32 w2[4], u32 w3[4], const u32 pw_le
|
||||
w3_t[2] = w3[2];
|
||||
w3_t[3] = w3[3];
|
||||
|
||||
switch_buffer_by_offset_le (w0_t, w1_t, w2_t, w3_t, 1);
|
||||
switch_buffer_by_offset_be (w0_t, w1_t, w2_t, w3_t, 1);
|
||||
|
||||
w0_t[0] |= pw_len & 0xff;
|
||||
w0_t[0] |= (pw_len & 0xff) << 24;
|
||||
w3_t[2] = 0;
|
||||
w3_t[3] = (1 + pw_len + domain_len + 1 + salt_len) * 8;
|
||||
|
||||
/**
|
||||
* sha1
|
||||
*/
|
||||
|
||||
w0_t[0] = swap32 (w0_t[0]);
|
||||
w0_t[1] = swap32 (w0_t[1]);
|
||||
w0_t[2] = swap32 (w0_t[2]);
|
||||
w0_t[3] = swap32 (w0_t[3]);
|
||||
w1_t[0] = swap32 (w1_t[0]);
|
||||
w1_t[1] = swap32 (w1_t[1]);
|
||||
w1_t[2] = swap32 (w1_t[2]);
|
||||
w1_t[3] = swap32 (w1_t[3]);
|
||||
w2_t[0] = swap32 (w2_t[0]);
|
||||
w2_t[1] = swap32 (w2_t[1]);
|
||||
w2_t[2] = swap32 (w2_t[2]);
|
||||
w2_t[3] = swap32 (w2_t[3]);
|
||||
w3_t[0] = swap32 (w3_t[0]);
|
||||
w3_t[1] = swap32 (w3_t[1]);
|
||||
w3_t[2] = 0;
|
||||
w3_t[3] = (1 + pw_len + domain_len + 1 + salt_len) * 8;
|
||||
|
||||
u32x digest[5];
|
||||
|
||||
digest[0] = SHA1M_A;
|
||||
@ -589,14 +551,14 @@ static void m08300s (u32 w0[4], u32 w1[4], u32 w2[4], u32 w3[4], const u32 pw_le
|
||||
w0_t[2] = digest[2];
|
||||
w0_t[3] = digest[3];
|
||||
w1_t[0] = digest[4];
|
||||
w1_t[1] = swap32 (salt_buf0[0]);
|
||||
w1_t[2] = swap32 (salt_buf0[1]);
|
||||
w1_t[3] = swap32 (salt_buf0[2]);
|
||||
w2_t[0] = swap32 (salt_buf0[3]);
|
||||
w2_t[1] = swap32 (salt_buf1[0]);
|
||||
w2_t[2] = swap32 (salt_buf1[1]);
|
||||
w2_t[3] = swap32 (salt_buf1[2]);
|
||||
w3_t[0] = swap32 (salt_buf1[3]);
|
||||
w1_t[1] = salt_buf0[0];
|
||||
w1_t[2] = salt_buf0[1];
|
||||
w1_t[3] = salt_buf0[2];
|
||||
w2_t[0] = salt_buf0[3];
|
||||
w2_t[1] = salt_buf1[0];
|
||||
w2_t[2] = salt_buf1[1];
|
||||
w2_t[3] = salt_buf1[2];
|
||||
w3_t[0] = salt_buf1[3];
|
||||
w3_t[1] = 0;
|
||||
w3_t[2] = 0;
|
||||
w3_t[3] = (20 + salt_len) * 8;
|
||||
|
@ -9329,7 +9329,7 @@ int main (int argc, char **argv)
|
||||
case 8300: hash_type = HASH_TYPE_SHA1;
|
||||
salt_type = SALT_TYPE_EMBEDDED;
|
||||
attack_exec = ATTACK_EXEC_INSIDE_KERNEL;
|
||||
opts_type = OPTS_TYPE_PT_GENERATE_LE
|
||||
opts_type = OPTS_TYPE_PT_GENERATE_BE
|
||||
| OPTS_TYPE_ST_HEX
|
||||
| OPTS_TYPE_ST_ADD80;
|
||||
kern_type = KERN_TYPE_NSEC3;
|
||||
|
@ -7238,6 +7238,12 @@ void ascii_digest (char *out_buf, uint salt_pos, uint digest_pos)
|
||||
{
|
||||
char digest_buf_c[34] = { 0 };
|
||||
|
||||
digest_buf[0] = byte_swap_32 (digest_buf[0]);
|
||||
digest_buf[1] = byte_swap_32 (digest_buf[1]);
|
||||
digest_buf[2] = byte_swap_32 (digest_buf[2]);
|
||||
digest_buf[3] = byte_swap_32 (digest_buf[3]);
|
||||
digest_buf[4] = byte_swap_32 (digest_buf[4]);
|
||||
|
||||
base32_encode (int_to_itoa32, (const u8 *) digest_buf, 20, (u8 *) digest_buf_c);
|
||||
|
||||
digest_buf_c[32] = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user