diff --git a/OpenCL/m27800_a0-optimized.cl b/OpenCL/m27800_a0-optimized.cl index 1d36d02ab..2286664ab 100644 --- a/OpenCL/m27800_a0-optimized.cl +++ b/OpenCL/m27800_a0-optimized.cl @@ -15,22 +15,25 @@ #include M2S(INCLUDE_PATH/inc_simd.cl) #endif -DECLSPEC u32 Murmur32_Scramble(u32 k) +DECLSPEC u32 Murmur32_Scramble (u32 k) { k = (k * 0x16A88000) | ((k * 0xCC9E2D51) >> 17); + return (k * 0x1B873593); } -DECLSPEC u32 MurmurHash3(const u32 seed, PRIVATE_AS const u32 *data, const u32 size) +DECLSPEC u32 MurmurHash3 (const u32 seed, PRIVATE_AS const u32 *data, const u32 size) { u32 checksum = seed; const u32 nBlocks = (size / 4); - if (size >= 4) //Hash blocks, sizes of 4 + + if (size >= 4) // Hash blocks, sizes of 4 { for (u32 i = 0; i < nBlocks; i++) { - checksum ^= Murmur32_Scramble(data[i]); + checksum ^= Murmur32_Scramble (data[i]); + checksum = (checksum >> 19) | (checksum << 13); //rotateRight(checksum, 19) checksum = (checksum * 5) + 0xE6546B64; } @@ -38,21 +41,23 @@ DECLSPEC u32 MurmurHash3(const u32 seed, PRIVATE_AS const u32 *data, const u32 s if (size % 4) { - PRIVATE_AS const u8 *remainder = (PRIVATE_AS u8 *)(data + nBlocks); + const u32 remainder = data[nBlocks]; + u32 val = 0; - switch(size & 3) //Hash remaining bytes as size isn't always aligned by 4 + switch (size & 3) //Hash remaining bytes as size isn't always aligned by 4 { case 3: - val ^= (remainder[2] << 16); + val ^= remainder & 0x00ff0000; case 2: - val ^= (remainder[1] << 8); + val ^= remainder & 0x0000ff00; case 1: - val ^= remainder[0]; - checksum ^= Murmur32_Scramble(val); + val ^= remainder & 0x000000ff; + + checksum ^= Murmur32_Scramble (val); default: break; - }; + } } checksum ^= size; @@ -60,6 +65,7 @@ DECLSPEC u32 MurmurHash3(const u32 seed, PRIVATE_AS const u32 *data, const u32 s checksum *= 0x85EBCA6B; checksum ^= checksum >> 13; checksum *= 0xC2B2AE35; + return checksum ^ (checksum >> 16); } diff --git a/OpenCL/m27800_a1-optimized.cl b/OpenCL/m27800_a1-optimized.cl index 877560560..cf6240bf2 100644 --- a/OpenCL/m27800_a1-optimized.cl +++ b/OpenCL/m27800_a1-optimized.cl @@ -13,22 +13,25 @@ #include M2S(INCLUDE_PATH/inc_simd.cl) #endif -DECLSPEC u32 Murmur32_Scramble(u32 k) +DECLSPEC u32 Murmur32_Scramble (u32 k) { k = (k * 0x16A88000) | ((k * 0xCC9E2D51) >> 17); + return (k * 0x1B873593); } -DECLSPEC u32 MurmurHash3(const u32 seed, PRIVATE_AS const u32 *data, const u32 size) +DECLSPEC u32 MurmurHash3 (const u32 seed, PRIVATE_AS const u32 *data, const u32 size) { u32 checksum = seed; const u32 nBlocks = (size / 4); - if (size >= 4) //Hash blocks, sizes of 4 + + if (size >= 4) // Hash blocks, sizes of 4 { for (u32 i = 0; i < nBlocks; i++) { - checksum ^= Murmur32_Scramble(data[i]); + checksum ^= Murmur32_Scramble (data[i]); + checksum = (checksum >> 19) | (checksum << 13); //rotateRight(checksum, 19) checksum = (checksum * 5) + 0xE6546B64; } @@ -36,21 +39,23 @@ DECLSPEC u32 MurmurHash3(const u32 seed, PRIVATE_AS const u32 *data, const u32 s if (size % 4) { - PRIVATE_AS const u8 *remainder = (PRIVATE_AS u8 *)(data + nBlocks); + const u32 remainder = data[nBlocks]; + u32 val = 0; - switch(size & 3) //Hash remaining bytes as size isn't always aligned by 4 + switch (size & 3) //Hash remaining bytes as size isn't always aligned by 4 { case 3: - val ^= (remainder[2] << 16); + val ^= remainder & 0x00ff0000; case 2: - val ^= (remainder[1] << 8); + val ^= remainder & 0x0000ff00; case 1: - val ^= remainder[0]; - checksum ^= Murmur32_Scramble(val); + val ^= remainder & 0x000000ff; + + checksum ^= Murmur32_Scramble (val); default: break; - }; + } } checksum ^= size; @@ -58,6 +63,7 @@ DECLSPEC u32 MurmurHash3(const u32 seed, PRIVATE_AS const u32 *data, const u32 s checksum *= 0x85EBCA6B; checksum ^= checksum >> 13; checksum *= 0xC2B2AE35; + return checksum ^ (checksum >> 16); } diff --git a/OpenCL/m27800_a3-optimized.cl b/OpenCL/m27800_a3-optimized.cl index 54cafd6e3..3f6f71861 100644 --- a/OpenCL/m27800_a3-optimized.cl +++ b/OpenCL/m27800_a3-optimized.cl @@ -13,72 +13,79 @@ #include M2S(INCLUDE_PATH/inc_simd.cl) #endif -DECLSPEC u32x Murmur32_Scramble(u32x k) +DECLSPEC u32x Murmur32_Scramble (u32x k) { k = (k * 0x16A88000) | ((k * 0xCC9E2D51) >> 17); + return (k * 0x1B873593); } -DECLSPEC u32x MurmurHash3(const u32 seed, const u32x w0, PRIVATE_AS const u32 *data, const u32 size) +DECLSPEC u32x MurmurHash3 (const u32 seed, const u32x w0, PRIVATE_AS const u32 *data, const u32 size) { u32x checksum = seed; - if (size >= 4) + if (size >= 4) // Hash blocks, sizes of 4 { - checksum ^= Murmur32_Scramble(w0); + checksum ^= Murmur32_Scramble (w0); + checksum = (checksum >> 19) | (checksum << 13); //rotateRight(checksum, 19) checksum = (checksum * 5) + 0xE6546B64; const u32 nBlocks = (size / 4); - if (size >= 4) //Hash blocks, sizes of 4 + + // if (size >= 4) // size didn't change, why should we check it again ? + // { + for (u32 i = 1; i < nBlocks; i++) { - for (u32 i = 1; i < nBlocks; i++) - { - checksum ^= Murmur32_Scramble(data[i]); - checksum = (checksum >> 19) | (checksum << 13); //rotateRight(checksum, 19) - checksum = (checksum * 5) + 0xE6546B64; - } + checksum ^= Murmur32_Scramble (data[i]); + + checksum = (checksum >> 19) | (checksum << 13); //rotateRight(checksum, 19) + checksum = (checksum * 5) + 0xE6546B64; } + //} if (size % 4) { - PRIVATE_AS const u8 *remainder = (PRIVATE_AS u8 *)(data + nBlocks); + const u32x remainder = data[nBlocks]; + u32x val = 0; - switch(size & 3) //Hash remaining bytes as size isn't always aligned by 4 + switch (size & 3) //Hash remaining bytes as size isn't always aligned by 4 { case 3: - val ^= (remainder[2] << 16); + val ^= remainder & 0x00ff0000; case 2: - val ^= (remainder[1] << 8); + val ^= remainder & 0x0000ff00; case 1: - val ^= remainder[0]; - checksum ^= Murmur32_Scramble(val); + val ^= remainder & 0x000000ff; + + checksum ^= Murmur32_Scramble (val); default: break; - }; + } } } - else { if (size % 4) { - PRIVATE_AS const u8 *remainder = (PRIVATE_AS u8 *)(&w0); + const u32x remainder = w0; + u32x val = 0; - switch(size & 3) + switch (size & 3) { case 3: - val ^= (remainder[2] << 16); + val ^= remainder & 0x00ff0000; case 2: - val ^= (remainder[1] << 8); + val ^= remainder & 0x0000ff00; case 1: - val ^= remainder[0]; - checksum ^= Murmur32_Scramble(val); + val ^= remainder & 0x000000ff; + + checksum ^= Murmur32_Scramble (val); default: break; - }; + } } } @@ -87,6 +94,7 @@ DECLSPEC u32x MurmurHash3(const u32 seed, const u32x w0, PRIVATE_AS const u32 *d checksum *= 0x85EBCA6B; checksum ^= checksum >> 13; checksum *= 0xC2B2AE35; + return checksum ^ (checksum >> 16); } diff --git a/docs/changes.txt b/docs/changes.txt index 7c163abda..0956ab978 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -4,10 +4,10 @@ ## Algorithms ## -- Added hash-mode: BLAKE2b-512($salt.$pass) -- Added hash-mode: BLAKE2b-512($pass.$salt) - Added hash-mode: Amazon AWS4-HMAC-SHA256 - Added hash-mode: Bitcoin WIF private key (P2PKH) +- Added hash-mode: BLAKE2b-512($pass.$salt) +- Added hash-mode: BLAKE2b-512($salt.$pass) - Added hash-mode: DPAPI masterkey file v1 (context 3) - Added hash-mode: DPAPI masterkey file v2 (context 3) - Added hash-mode: Exodus Desktop Wallet (scrypt) @@ -45,9 +45,10 @@ - Fixed display problem of incorrect negative values in case of large numbers - Fixed display problem of the "Optimizers applied" list for algorithms using Register-Limit - Fixed example password output of --hash-info: force uppercase if OPTS_TYPE_PT_UPPER is set -- Fixed false negative on hash-types 4510 and 4710 for hashes with long salts - Fixed false negative on Unit Test in case of out-of-memory with grep in single mode - Fixed false negative on Unit Test with hash-type 25400 +- Fixed false negative on hash-type 27800 if using vector width greater than 1 and -a 3 +- Fixed false negative on hash-types 4510 and 4710 for hashes with long salts - Fixed false negative on hash-types 8900, 15700, 22700, 27700 and 28200 if using the HIP backend - Fixed functional error when nonce-error-corrections that were set on the command line in hash-mode 22000/22001 were not accepted - Fixed handling of devices in benchmark mode for "kernel build error". Instead of canceling, skip the device and move on to the next diff --git a/docs/readme.txt b/docs/readme.txt index e635c552c..62a3d2197 100644 --- a/docs/readme.txt +++ b/docs/readme.txt @@ -189,6 +189,7 @@ NVIDIA GPUs require "NVIDIA Driver" (440.64 or later) and "CUDA Toolkit" (9.0 or - NetNTLMv1 / NetNTLMv1+ESS (NT) - NetNTLMv2 - NetNTLMv2 (NT) +- Amazon AWS4-HMAC-SHA256 - Flask Session Cookie - iSCSI CHAP authentication, MD5(CHAP) - RACF @@ -243,6 +244,7 @@ NVIDIA GPUs require "NVIDIA Driver" (440.64 or later) and "CUDA Toolkit" (9.0 or - MongoDB ServerKey SCRAM-SHA-256 - PostgreSQL - PostgreSQL CRAM (MD5) +- PostgreSQL SCRAM-SHA-256 - Oracle H: Type (Oracle 7+) - Oracle S: Type (Oracle 11+) - Oracle T: Type (Oracle 12+) diff --git a/tools/install_modules.sh b/tools/install_modules.sh index 1536d1824..8ca92452f 100755 --- a/tools/install_modules.sh +++ b/tools/install_modules.sh @@ -50,6 +50,7 @@ cpan install Authen::Passphrase::LANManager \ Digest::Keccak \ Digest::MD4 \ Digest::MD5 \ + Digest::MurmurHash3 \ Digest::Perl::MD5 \ Digest::SHA \ Digest::SHA1 \ diff --git a/tools/test.sh b/tools/test.sh index 650997b77..393d36343 100755 --- a/tools/test.sh +++ b/tools/test.sh @@ -19,7 +19,7 @@ TC_MODES="6211 6212 6213 6221 6222 6223 6231 6232 6233 6241 6242 6243 29311 2931 VC_MODES="13711 13712 13713 13721 13722 13723 13731 13732 13733 13741 13742 13743 13751 13752 13753 13761 13762 13763 13771 13772 13773 13781 13782 13783" # List of modes which either are OPTS_TYPE_PT_NEVERCRACK or produce collisions -NEVER_CRACK="9720 9820 14900 18100" +NEVER_CRACK="9720 9820 14900 18100 27800" # List of modes which return a different output hash format than the input hash format NOCHECK_ENCODING="16800 22000" diff --git a/tools/test_modules/m27800.pm b/tools/test_modules/m27800.pm new file mode 100644 index 000000000..1a9b55d8b --- /dev/null +++ b/tools/test_modules/m27800.pm @@ -0,0 +1,51 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Digest::MurmurHash3 qw (murmur32); + +sub module_constraints { [[-1, -1], [-1, -1], [0, 31], [8, 8], [-1, -1]] } + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + + my $seed = unpack ("I>", pack ("H*", $salt)); + + my $digest = murmur32 ($word, $seed); + + $digest = unpack ("H*", pack ("I>", $digest)); + + my $hash = sprintf ("%s:%s", $digest, $salt); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash, $seed, $word) = split (':', $line); + + return unless defined $hash; + return unless defined $seed; + return unless defined $word; + + return unless ($hash =~ m/^[0-9a-fA-F]{8}$/); + return unless ($seed =~ m/^[0-9a-fA-F]{8}$/); + + my $word_packed = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word_packed, $seed); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m29100.pm b/tools/test_modules/m29100.pm index 3e3935f27..be59ff279 100644 --- a/tools/test_modules/m29100.pm +++ b/tools/test_modules/m29100.pm @@ -10,9 +10,8 @@ use warnings; use Digest::SHA qw (sha1); use Digest::HMAC qw (hmac); -use MIME::Base64 qw (encode_base64url decode_base64url); -use JSON qw (encode_json decode_json); -use Data::Dumper; +use MIME::Base64 qw (encode_base64url); +use JSON qw (encode_json); sub module_constraints { [[0, 64], [-1, -1], [-1, -1], [-1, -1], [-1, -1]] }