From 0d6b9d041924fbd397030494b82d58f3eb1ee83c Mon Sep 17 00:00:00 2001 From: philsmd Date: Thu, 17 Aug 2017 11:29:04 +0200 Subject: [PATCH] fixes #1313: keep/print the original salt for descrypt hashes --- docs/changes.txt | 1 + src/interface.c | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/docs/changes.txt b/docs/changes.txt index 3a84a179e..4b85bbd0b 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -26,6 +26,7 @@ - Fixed the version number used in the restore file header - Fixed the parsing of command line options. It doesn't show two times the same error about an invalid option anymore. - Fixed the estimated time value whenever the value is very large and overflows +- Fixed the parsing of descrypt hashes if the hashes do have non-standard characters within the salt ## ## Improvements diff --git a/src/interface.c b/src/interface.c index 399038f84..b6dee23c0 100644 --- a/src/interface.c +++ b/src/interface.c @@ -3784,7 +3784,13 @@ int descrypt_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_U salt->salt_buf[0] = itoa64_to_int (input_buf[0]) | itoa64_to_int (input_buf[1]) << 6; - salt->salt_len = 2; + // we need to add 2 additional bytes (the salt sign) such that the salt sorting algorithm + // doesn't eliminate salts that are identical but have different salt signs + + salt->salt_buf[0] |= input_buf[0] << 16 + | input_buf[1] << 24; + + salt->salt_len = 4; // actually it is only 2 (but we need to add the original salt_sign to it) u8 tmp_buf[100] = { 0 };