1
0
mirror of https://github.com/hashcat/hashcat.git synced 2024-11-26 01:50:10 +00:00

Update existing encoder / decoder to work with updated converter functions

This commit is contained in:
jsteube 2019-01-08 20:11:12 +01:00
parent 105c0ce0cb
commit 5bc292fe9b
3 changed files with 24 additions and 47 deletions

View File

@ -30,7 +30,8 @@ static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE
| OPTI_TYPE_NOT_ITERATED | OPTI_TYPE_NOT_ITERATED
| OPTI_TYPE_NOT_SALTED | OPTI_TYPE_NOT_SALTED
| OPTI_TYPE_RAW_HASH; | OPTI_TYPE_RAW_HASH;
static const u32 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE static const u64 OPTS_TYPE = OPTS_TYPE_STATE_BUFFER_LE
| OPTS_TYPE_PT_GENERATE_LE
| OPTS_TYPE_PT_ADD80 | OPTS_TYPE_PT_ADD80
| OPTS_TYPE_PT_ADDBITS14; | OPTS_TYPE_PT_ADDBITS14;
static const char *ST_HASH = "8743b52063cd84097a65d1633f5c74f5"; static const char *ST_HASH = "8743b52063cd84097a65d1633f5c74f5";

View File

@ -30,7 +30,8 @@ static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE
| OPTI_TYPE_NOT_ITERATED | OPTI_TYPE_NOT_ITERATED
| OPTI_TYPE_NOT_SALTED | OPTI_TYPE_NOT_SALTED
| OPTI_TYPE_RAW_HASH; | OPTI_TYPE_RAW_HASH;
static const u32 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE static const u64 OPTS_TYPE = OPTS_TYPE_STATE_BUFFER_LE
| OPTS_TYPE_PT_GENERATE_LE
| OPTS_TYPE_PT_ADD80 | OPTS_TYPE_PT_ADD80
| OPTS_TYPE_PT_ADDBITS14 | OPTS_TYPE_PT_ADDBITS14
| OPTS_TYPE_PT_UTF16LE; | OPTS_TYPE_PT_UTF16LE;

View File

@ -30,7 +30,8 @@ static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE
| OPTI_TYPE_NOT_SALTED | OPTI_TYPE_NOT_SALTED
| OPTI_TYPE_USES_BITS_64 | OPTI_TYPE_USES_BITS_64
| OPTI_TYPE_RAW_HASH; | OPTI_TYPE_RAW_HASH;
static const u32 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE static const u64 OPTS_TYPE = OPTS_TYPE_STATE_BUFFER_BE
| OPTS_TYPE_PT_GENERATE_BE
| OPTS_TYPE_PT_ADD80 | OPTS_TYPE_PT_ADD80
| OPTS_TYPE_PT_ADDBITS15; | OPTS_TYPE_PT_ADDBITS15;
static const char *ST_HASH = "82a9dda829eb7f8ffe9fbe49e45d47d2dad9664fbb7adf72492e3c81ebd3e29134d9bc12212bf83c6840f10e8246b9db54a4859b7ccd0123d86e5872c1e5082f"; static const char *ST_HASH = "82a9dda829eb7f8ffe9fbe49e45d47d2dad9664fbb7adf72492e3c81ebd3e29134d9bc12212bf83c6840f10e8246b9db54a4859b7ccd0123d86e5872c1e5082f";
@ -77,15 +78,6 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
digest[6] = hex_to_u64 (hash_pos + 96); digest[6] = hex_to_u64 (hash_pos + 96);
digest[7] = hex_to_u64 (hash_pos + 112); digest[7] = hex_to_u64 (hash_pos + 112);
digest[0] = byte_swap_64 (digest[0]);
digest[1] = byte_swap_64 (digest[1]);
digest[2] = byte_swap_64 (digest[2]);
digest[3] = byte_swap_64 (digest[3]);
digest[4] = byte_swap_64 (digest[4]);
digest[5] = byte_swap_64 (digest[5]);
digest[6] = byte_swap_64 (digest[6]);
digest[7] = byte_swap_64 (digest[7]);
decoder_apply_options (hashconfig, digest); decoder_apply_options (hashconfig, digest);
decoder_apply_optimizer (hashconfig, digest); decoder_apply_optimizer (hashconfig, digest);
@ -95,30 +87,21 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, char *line_buf, MAYBE_UNUSED const int line_size) int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, char *line_buf, MAYBE_UNUSED const int line_size)
{ {
const u32 *digest = (const u32 *) digest_buf; const u64 *digest = (const u64 *) digest_buf;
// we can not change anything in the original buffer, otherwise destroying sorting // we can not change anything in the original buffer, otherwise destroying sorting
// therefore create some local buffer // therefore create some local buffer
u32 tmp[16]; u64 tmp[8];
tmp[0] = digest[1]; tmp[0] = digest[0];
tmp[1] = digest[0]; tmp[1] = digest[1];
tmp[2] = digest[3]; tmp[2] = digest[2];
tmp[3] = digest[2]; tmp[3] = digest[3];
tmp[4] = digest[5]; tmp[4] = digest[4];
tmp[5] = digest[4]; tmp[5] = digest[5];
tmp[6] = digest[7]; tmp[6] = digest[6];
tmp[7] = digest[6]; tmp[7] = digest[7];
tmp[8] = digest[9];
tmp[9] = digest[8];
tmp[10] = digest[11];
tmp[11] = digest[10];
tmp[12] = digest[13];
tmp[13] = digest[12];
tmp[14] = digest[15];
tmp[15] = digest[14];
encoder_apply_optimizer (hashconfig, tmp); encoder_apply_optimizer (hashconfig, tmp);
@ -126,22 +109,14 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
u8 *out_buf = (u8 *) line_buf; u8 *out_buf = (u8 *) line_buf;
u32_to_hex (tmp[ 0], out_buf + 0); u64_to_hex (tmp[0], out_buf + 0);
u32_to_hex (tmp[ 1], out_buf + 8); u64_to_hex (tmp[1], out_buf + 16);
u32_to_hex (tmp[ 2], out_buf + 16); u64_to_hex (tmp[2], out_buf + 32);
u32_to_hex (tmp[ 3], out_buf + 24); u64_to_hex (tmp[3], out_buf + 48);
u32_to_hex (tmp[ 4], out_buf + 32); u64_to_hex (tmp[4], out_buf + 64);
u32_to_hex (tmp[ 5], out_buf + 40); u64_to_hex (tmp[5], out_buf + 80);
u32_to_hex (tmp[ 6], out_buf + 48); u64_to_hex (tmp[6], out_buf + 96);
u32_to_hex (tmp[ 7], out_buf + 56); u64_to_hex (tmp[7], out_buf + 112);
u32_to_hex (tmp[ 8], out_buf + 64);
u32_to_hex (tmp[ 9], out_buf + 72);
u32_to_hex (tmp[10], out_buf + 80);
u32_to_hex (tmp[11], out_buf + 88);
u32_to_hex (tmp[12], out_buf + 96);
u32_to_hex (tmp[13], out_buf + 104);
u32_to_hex (tmp[14], out_buf + 112);
u32_to_hex (tmp[15], out_buf + 120);
const int out_len = 128; const int out_len = 128;