From 5bc292fe9b7e216ea81b389786a4e9a614a8d7cc Mon Sep 17 00:00:00 2001 From: jsteube Date: Tue, 8 Jan 2019 20:11:12 +0100 Subject: [PATCH] Update existing encoder / decoder to work with updated converter functions --- modules/module_00000.c | 3 +- modules/module_01000.c | 3 +- modules/module_01700.c | 67 +++++++++++++----------------------------- 3 files changed, 25 insertions(+), 48 deletions(-) diff --git a/modules/module_00000.c b/modules/module_00000.c index 7caf1de22..6713e1645 100644 --- a/modules/module_00000.c +++ b/modules/module_00000.c @@ -30,7 +30,8 @@ static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE | OPTI_TYPE_NOT_ITERATED | OPTI_TYPE_NOT_SALTED | 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_ADDBITS14; static const char *ST_HASH = "8743b52063cd84097a65d1633f5c74f5"; diff --git a/modules/module_01000.c b/modules/module_01000.c index 7c83127d8..1d0b30e3f 100644 --- a/modules/module_01000.c +++ b/modules/module_01000.c @@ -30,7 +30,8 @@ static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE | OPTI_TYPE_NOT_ITERATED | OPTI_TYPE_NOT_SALTED | 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_ADDBITS14 | OPTS_TYPE_PT_UTF16LE; diff --git a/modules/module_01700.c b/modules/module_01700.c index f43c49178..4efc8d927 100644 --- a/modules/module_01700.c +++ b/modules/module_01700.c @@ -30,7 +30,8 @@ static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE | OPTI_TYPE_NOT_SALTED | OPTI_TYPE_USES_BITS_64 | 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_ADDBITS15; 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[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_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) { - 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 // therefore create some local buffer - u32 tmp[16]; - - tmp[0] = digest[1]; - tmp[1] = digest[0]; - tmp[2] = digest[3]; - tmp[3] = digest[2]; - tmp[4] = digest[5]; - tmp[5] = digest[4]; - tmp[6] = digest[7]; - tmp[7] = digest[6]; - - 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]; + u64 tmp[8]; + + tmp[0] = digest[0]; + tmp[1] = digest[1]; + tmp[2] = digest[2]; + tmp[3] = digest[3]; + tmp[4] = digest[4]; + tmp[5] = digest[5]; + tmp[6] = digest[6]; + tmp[7] = digest[7]; 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; - u32_to_hex (tmp[ 0], out_buf + 0); - u32_to_hex (tmp[ 1], out_buf + 8); - u32_to_hex (tmp[ 2], out_buf + 16); - u32_to_hex (tmp[ 3], out_buf + 24); - u32_to_hex (tmp[ 4], out_buf + 32); - u32_to_hex (tmp[ 5], out_buf + 40); - u32_to_hex (tmp[ 6], out_buf + 48); - u32_to_hex (tmp[ 7], out_buf + 56); - 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); + u64_to_hex (tmp[0], out_buf + 0); + u64_to_hex (tmp[1], out_buf + 16); + u64_to_hex (tmp[2], out_buf + 32); + u64_to_hex (tmp[3], out_buf + 48); + u64_to_hex (tmp[4], out_buf + 64); + u64_to_hex (tmp[5], out_buf + 80); + u64_to_hex (tmp[6], out_buf + 96); + u64_to_hex (tmp[7], out_buf + 112); const int out_len = 128;