From 909d7ab63635abedbb8c7b2fafe0ace449f29b41 Mon Sep 17 00:00:00 2001 From: Francois Gaudreault Date: Wed, 27 Apr 2016 07:40:13 -0400 Subject: [PATCH 1/2] Adding final code to test.pl --- tools/test.pl | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tools/test.pl b/tools/test.pl index 9a56ac47d..1db1d9eb3 100755 --- a/tools/test.pl +++ b/tools/test.pl @@ -2675,6 +2675,15 @@ sub verify return unless (substr ($line, 0, $len) eq $hash_out); } + elsif ($mode == 13500) + { + $hash_out = gen_hash ($mode, $word, $salt); + + $len = length $hash_out; + print $hash_out; + + return unless (substr ($line, 0, $len) eq $hash_out); + } else { $hash_out = gen_hash ($mode, $word, $salt, $iter); From abce366d00401246bed742d584397fedc9a97327 Mon Sep 17 00:00:00 2001 From: Jens Steube Date: Thu, 28 Apr 2016 22:23:02 +0200 Subject: [PATCH 2/2] Fixed -m 13500 kernels and tests --- OpenCL/m13500_a0.cl | 21 --------------------- OpenCL/m13500_a1.cl | 21 --------------------- OpenCL/m13500_a3.cl | 21 --------------------- src/shared.c | 37 +++++++++++++++++-------------------- tools/test.pl | 28 +++++++--------------------- tools/test.sh | 2 +- 6 files changed, 25 insertions(+), 105 deletions(-) diff --git a/OpenCL/m13500_a0.cl b/OpenCL/m13500_a0.cl index 85f318cb4..cad6aa846 100644 --- a/OpenCL/m13500_a0.cl +++ b/OpenCL/m13500_a0.cl @@ -86,27 +86,6 @@ static void memcat64c_be (u32x block[16], const u32 offset, u32x carry[16]) tmp14 = amd_bytealign (carry[13], carry[14], offset); tmp15 = amd_bytealign (carry[14], carry[15], offset); tmp16 = amd_bytealign (carry[15], 0, offset); - - if (mod == 0) - { - tmp00 = tmp01; - tmp01 = tmp02; - tmp02 = tmp03; - tmp03 = tmp04; - tmp04 = tmp05; - tmp05 = tmp06; - tmp06 = tmp07; - tmp07 = tmp08; - tmp08 = tmp09; - tmp09 = tmp10; - tmp10 = tmp11; - tmp11 = tmp12; - tmp12 = tmp13; - tmp13 = tmp14; - tmp14 = tmp15; - tmp15 = tmp16; - tmp16 = 0; - } #endif carry[ 0] = 0; diff --git a/OpenCL/m13500_a1.cl b/OpenCL/m13500_a1.cl index 77ac8df0b..9d80e1cf4 100644 --- a/OpenCL/m13500_a1.cl +++ b/OpenCL/m13500_a1.cl @@ -84,27 +84,6 @@ static void memcat64c_be (u32x block[16], const u32 offset, u32x carry[16]) tmp14 = amd_bytealign (carry[13], carry[14], offset); tmp15 = amd_bytealign (carry[14], carry[15], offset); tmp16 = amd_bytealign (carry[15], 0, offset); - - if (mod == 0) - { - tmp00 = tmp01; - tmp01 = tmp02; - tmp02 = tmp03; - tmp03 = tmp04; - tmp04 = tmp05; - tmp05 = tmp06; - tmp06 = tmp07; - tmp07 = tmp08; - tmp08 = tmp09; - tmp09 = tmp10; - tmp10 = tmp11; - tmp11 = tmp12; - tmp12 = tmp13; - tmp13 = tmp14; - tmp14 = tmp15; - tmp15 = tmp16; - tmp16 = 0; - } #endif carry[ 0] = 0; diff --git a/OpenCL/m13500_a3.cl b/OpenCL/m13500_a3.cl index 92a526f4b..210471fa2 100644 --- a/OpenCL/m13500_a3.cl +++ b/OpenCL/m13500_a3.cl @@ -84,27 +84,6 @@ static void memcat64c_be (u32x block[16], const u32 offset, u32x carry[16]) tmp14 = amd_bytealign (carry[13], carry[14], offset); tmp15 = amd_bytealign (carry[14], carry[15], offset); tmp16 = amd_bytealign (carry[15], 0, offset); - - if (mod == 0) - { - tmp00 = tmp01; - tmp01 = tmp02; - tmp02 = tmp03; - tmp03 = tmp04; - tmp04 = tmp05; - tmp05 = tmp06; - tmp06 = tmp07; - tmp07 = tmp08; - tmp08 = tmp09; - tmp09 = tmp10; - tmp10 = tmp11; - tmp11 = tmp12; - tmp12 = tmp13; - tmp13 = tmp14; - tmp14 = tmp15; - tmp15 = tmp16; - tmp16 = 0; - } #endif carry[ 0] = 0; diff --git a/src/shared.c b/src/shared.c index c17b7c9c6..3aca24369 100644 --- a/src/shared.c +++ b/src/shared.c @@ -11815,8 +11815,6 @@ int pstoken_parse_hash (char *input_buf, uint input_len, hash_t *hash_buf) pstoken->salt_len = salt_len / 2; - salt->salt_len = 32; - /* some fake salt for the sorting mechanisms */ salt->salt_buf[0] = pstoken->salt_buf[0]; @@ -11841,26 +11839,26 @@ int pstoken_parse_hash (char *input_buf, uint input_len, hash_t *hash_buf) pstoken->pc_offset = 0; - for (uint i = 0; i < pstoken->salt_len - 64; i += 64) + for (int i = 0; i < (int) pstoken->salt_len - 64; i += 64) { uint w[16]; - w[ 0] = byte_swap_32 (pstoken->salt_buf[i + 0]); - w[ 1] = byte_swap_32 (pstoken->salt_buf[i + 1]); - w[ 2] = byte_swap_32 (pstoken->salt_buf[i + 2]); - w[ 3] = byte_swap_32 (pstoken->salt_buf[i + 3]); - w[ 4] = byte_swap_32 (pstoken->salt_buf[i + 4]); - w[ 5] = byte_swap_32 (pstoken->salt_buf[i + 5]); - w[ 6] = byte_swap_32 (pstoken->salt_buf[i + 6]); - w[ 7] = byte_swap_32 (pstoken->salt_buf[i + 7]); - w[ 8] = byte_swap_32 (pstoken->salt_buf[i + 8]); - w[ 9] = byte_swap_32 (pstoken->salt_buf[i + 9]); - w[10] = byte_swap_32 (pstoken->salt_buf[i + 10]); - w[11] = byte_swap_32 (pstoken->salt_buf[i + 11]); - w[12] = byte_swap_32 (pstoken->salt_buf[i + 12]); - w[13] = byte_swap_32 (pstoken->salt_buf[i + 13]); - w[14] = byte_swap_32 (pstoken->salt_buf[i + 14]); - w[15] = byte_swap_32 (pstoken->salt_buf[i + 15]); + w[ 0] = byte_swap_32 (pstoken->salt_buf[pstoken->pc_offset + 0]); + w[ 1] = byte_swap_32 (pstoken->salt_buf[pstoken->pc_offset + 1]); + w[ 2] = byte_swap_32 (pstoken->salt_buf[pstoken->pc_offset + 2]); + w[ 3] = byte_swap_32 (pstoken->salt_buf[pstoken->pc_offset + 3]); + w[ 4] = byte_swap_32 (pstoken->salt_buf[pstoken->pc_offset + 4]); + w[ 5] = byte_swap_32 (pstoken->salt_buf[pstoken->pc_offset + 5]); + w[ 6] = byte_swap_32 (pstoken->salt_buf[pstoken->pc_offset + 6]); + w[ 7] = byte_swap_32 (pstoken->salt_buf[pstoken->pc_offset + 7]); + w[ 8] = byte_swap_32 (pstoken->salt_buf[pstoken->pc_offset + 8]); + w[ 9] = byte_swap_32 (pstoken->salt_buf[pstoken->pc_offset + 9]); + w[10] = byte_swap_32 (pstoken->salt_buf[pstoken->pc_offset + 10]); + w[11] = byte_swap_32 (pstoken->salt_buf[pstoken->pc_offset + 11]); + w[12] = byte_swap_32 (pstoken->salt_buf[pstoken->pc_offset + 12]); + w[13] = byte_swap_32 (pstoken->salt_buf[pstoken->pc_offset + 13]); + w[14] = byte_swap_32 (pstoken->salt_buf[pstoken->pc_offset + 14]); + w[15] = byte_swap_32 (pstoken->salt_buf[pstoken->pc_offset + 15]); sha1_64 (w, pstoken->pc_digest); @@ -11870,7 +11868,6 @@ int pstoken_parse_hash (char *input_buf, uint input_len, hash_t *hash_buf) return (PARSER_OK); } - int sha1b64_parse_hash (char *input_buf, uint input_len, hash_t *hash_buf) { if ((input_len < DISPLAY_LEN_MIN_101) || (input_len > DISPLAY_LEN_MAX_101)) return (PARSER_GLOBAL_LENGTH); diff --git a/tools/test.pl b/tools/test.pl index 1db1d9eb3..61e62efb9 100755 --- a/tools/test.pl +++ b/tools/test.pl @@ -2675,15 +2675,6 @@ sub verify return unless (substr ($line, 0, $len) eq $hash_out); } - elsif ($mode == 13500) - { - $hash_out = gen_hash ($mode, $word, $salt); - - $len = length $hash_out; - print $hash_out; - - return unless (substr ($line, 0, $len) eq $hash_out); - } else { $hash_out = gen_hash ($mode, $word, $salt, $iter); @@ -7165,7 +7156,7 @@ END_CODE } elsif ($mode == 13500) { - $hash_buf = sha1_hex (pack("H*",$salt_buf) . encode ("UTF-16LE", $word_buf)); + $hash_buf = sha1_hex (pack ("H*", $salt_buf) . encode ("UTF-16LE", $word_buf)); $tmp_hash = sprintf ("%s:%s", $hash_buf, $salt_buf); } @@ -8668,17 +8659,12 @@ sub get_random_keepass_salt sub get_pstoken_salt { - # Cannot be fully random because of the salt structure, will use a constant salt. - my $pstoken_const = - "\x71\x00\x00\x00\x04\x03\x02\x01\x01\x00\x00\x00\xbc\x02" . - "\x00\x00\x00\x00\x00\x00\x10\x50\x00\x50\x00\x57\x00\x45" . - "\x00\x42\x00\x45\x00\x58\x00\x54\x00\x06\x45\x00\x4e\x00" . - "\x47\x00\x0e\x50\x00\x53\x00\x46\x00\x54\x00\x5f\x00\x48" . - "\x00\x52\x00\x34\x32\x00\x30\x00\x31\x00\x36\x00\x2d\x00" . - "\x30\x00\x34\x00\x2d\x00\x30\x00\x38\x00\x2d\x00\x31\x00" . - "\x39\x00\x2e\x00\x32\x00\x37\x00\x2e\x00\x30\x00\x35\x00" . - "\x2e\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x32\x00" . - "\x00"; + my $pstoken_length = get_random_num (16, 256); + + ## not a valid pstoken but a better test + ## because of random length + + my $pstoken_const = randbytes ($pstoken_length); return unpack ("H*", $pstoken_const); } diff --git a/tools/test.sh b/tools/test.sh index e1455434e..f093a29d7 100755 --- a/tools/test.sh +++ b/tools/test.sh @@ -23,7 +23,7 @@ HASHFILE_ONLY="2500" NEVER_CRACK="11600" -SLOW_ALGOS="400 500 501 1600 1800 2100 2500 3200 5200 5800 6211 6221 6231 6241 6251 6261 6271 6281 6300 6400 6500 6600 6700 6800 7100 7200 7400 7900 8200 8800 8900 9000 9100 9200 9300 9400 9500 9600 10000 10300 10500 10700 10900 11300 11600 11900 12000 12100 12200 12300 12400 12500 12800 12900 13000 13200 13400 13500" +SLOW_ALGOS="400 500 501 1600 1800 2100 2500 3200 5200 5800 6211 6221 6231 6241 6251 6261 6271 6281 6300 6400 6500 6600 6700 6800 7100 7200 7400 7900 8200 8800 8900 9000 9100 9200 9300 9400 9500 9600 10000 10300 10500 10700 10900 11300 11600 11900 12000 12100 12200 12300 12400 12500 12800 12900 13000 13200 13400" OPTS="--quiet --force --potfile-disable --runtime 200 --gpu-temp-disable --weak-hash-threshold=0 -u 1024 -n 128"