From 3cdee2e06e7f42ba0c6f3a6591f67cd6d38492e1 Mon Sep 17 00:00:00 2001 From: jsteube Date: Sat, 9 Jan 2016 21:35:29 +0100 Subject: [PATCH] We need an esalt to hold the unused IV otherwise the unique salt count becomes incorrect in multihash sitations --- include/types.h | 6 ++++++ src/oclHashcat.c | 1 + src/shared.c | 24 +++++++++++++++--------- tools/test.pl | 2 -- 4 files changed, 22 insertions(+), 11 deletions(-) diff --git a/include/types.h b/include/types.h index 7be171351..a4fdbf8a2 100644 --- a/include/types.h +++ b/include/types.h @@ -31,6 +31,12 @@ typedef struct } salt_t; +typedef struct +{ + uint iv[4]; + +} rar5_t; + typedef struct { int V; diff --git a/src/oclHashcat.c b/src/oclHashcat.c index 82a52118b..4040e51dd 100644 --- a/src/oclHashcat.c +++ b/src/oclHashcat.c @@ -9911,6 +9911,7 @@ int main (int argc, char **argv) case 11900: esalt_size = sizeof (pbkdf2_md5_t); break; case 12000: esalt_size = sizeof (pbkdf2_sha1_t); break; case 12100: esalt_size = sizeof (pbkdf2_sha512_t); break; + case 13000: esalt_size = sizeof (rar5_t); break; } data.esalt_size = esalt_size; diff --git a/src/shared.c b/src/shared.c index 9b251f1eb..2ea682fc6 100644 --- a/src/shared.c +++ b/src/shared.c @@ -8071,16 +8071,20 @@ void ascii_digest (char out_buf[4096], uint salt_pos, uint digest_pos) } else if (hash_mode == 13000) { + rar5_t *rar5s = (rar5_t *) data.esalts_buf; + + rar5_t *rar5 = &rar5s[salt_pos]; + snprintf (out_buf, len-1, "$rar5$16$%08x%08x%08x%08x$%u$%08x%08x%08x%08x$8$%08x%08x", salt.salt_buf[0], salt.salt_buf[1], salt.salt_buf[2], salt.salt_buf[3], salt.salt_sign[0], - salt.salt_buf[4], - salt.salt_buf[5], - salt.salt_buf[6], - salt.salt_buf[7], + rar5->iv[0], + rar5->iv[1], + rar5->iv[2], + rar5->iv[3], byte_swap_32 (digest_buf[0]), byte_swap_32 (digest_buf[1]) ); @@ -18394,6 +18398,8 @@ int rar5_parse_hash (char *input_buf, uint input_len, hash_t *hash_buf) salt_t *salt = hash_buf->salt; + rar5_t *rar5 = (rar5_t *) hash_buf->esalt; + /** * parse line */ @@ -18471,12 +18477,12 @@ int rar5_parse_hash (char *input_buf, uint input_len, hash_t *hash_buf) salt->salt_buf[2] = hex_to_uint (&salt_buf[16]); salt->salt_buf[3] = hex_to_uint (&salt_buf[24]); - salt->salt_buf[4] = hex_to_uint (&iv[ 0]); - salt->salt_buf[5] = hex_to_uint (&iv[ 8]); - salt->salt_buf[6] = hex_to_uint (&iv[16]); - salt->salt_buf[7] = hex_to_uint (&iv[24]); + rar5->iv[0] = hex_to_uint (&iv[ 0]); + rar5->iv[1] = hex_to_uint (&iv[ 8]); + rar5->iv[2] = hex_to_uint (&iv[16]); + rar5->iv[3] = hex_to_uint (&iv[24]); - salt->salt_len = 16 + 16; + salt->salt_len = 16; salt->salt_sign[0] = iterations; diff --git a/tools/test.pl b/tools/test.pl index f02d707da..9e61ad664 100755 --- a/tools/test.pl +++ b/tools/test.pl @@ -6605,8 +6605,6 @@ END_CODE my $hash = $pbkdf2->PBKDF2 ($salt_buf_bin, $word_buf); -printf ("%s\n", unpack ("H*", $hash)); - my $hash_final = substr ($hash, 0, 8) ^ substr ($hash, 8, 8) ^ substr ($hash, 16, 8)