1
0
mirror of https://github.com/hashcat/hashcat.git synced 2024-11-26 01:50:10 +00:00

Fixed more constraints in unit tests

This commit is contained in:
jsteube 2019-02-16 16:04:37 +01:00
parent 44b15049e7
commit f2e2967eec
47 changed files with 52 additions and 63 deletions

View File

@ -289,32 +289,21 @@ sub get_module_constraints
$constraints->[0]->[0] = $constraints->[2]->[0]; $constraints->[0]->[0] = $constraints->[2]->[0];
$constraints->[0]->[1] = $constraints->[2]->[1]; $constraints->[0]->[1] = $constraints->[2]->[1];
$constraints->[1]->[0] = $constraints->[3]->[0];
$constraints->[1]->[1] = $constraints->[3]->[1];
$IS_OPTIMIZED = 1; $IS_OPTIMIZED = 1;
} }
elsif (($constraints->[2]->[0] == -1) && ($constraints->[2]->[1] == -1))
if (($constraints->[1]->[0] == -1) && ($constraints->[1]->[1] == -1))
{
# hash-mode doesn't have a pure kernel, use optimized salt settings
$constraints->[1]->[0] = $constraints->[3]->[0];
$constraints->[1]->[1] = $constraints->[3]->[1];
}
if (($constraints->[2]->[0] == -1) && ($constraints->[2]->[1] == -1))
{ {
# hash-mode doesn't have a optimized kernel, use pure password settings # hash-mode doesn't have a optimized kernel, use pure password settings
$constraints->[2]->[0] = $constraints->[0]->[0]; $constraints->[2]->[0] = $constraints->[0]->[0];
$constraints->[2]->[1] = $constraints->[0]->[1]; $constraints->[2]->[1] = $constraints->[0]->[1];
}
if (($constraints->[3]->[0] == -1) && ($constraints->[3]->[1] == -1))
{
# hash-mode doesn't have a optimized kernel, use pure salt settings
$constraints->[3]->[0] = $constraints->[1]->[0]; $constraints->[3]->[0] = $constraints->[1]->[0];
$constraints->[3]->[1] = $constraints->[1]->[1]; $constraints->[3]->[1] = $constraints->[1]->[1];
$IS_OPTIMIZED = 0;
} }
return $constraints; return $constraints;

View File

@ -8,7 +8,7 @@
use strict; use strict;
use warnings; use warnings;
sub module_constraints { [[0, 8], [2, 2], [0, 8], [2, 2], [-1, -1]] } sub module_constraints { [[-1, -1], [-1, -1], [0, 8], [2, 2], [-1, -1]] }
sub module_generate_hash sub module_generate_hash
{ {

View File

@ -12,7 +12,7 @@ use Digest::MD4 qw (md4 md4_hex);
use Crypt::PBKDF2; use Crypt::PBKDF2;
use Encode; use Encode;
sub module_constraints { [[0, 127], [0, 239], [0, 27], [0, 39], [-1, -1]] } sub module_constraints { [[0, 255], [0, 255], [-1, -1], [-1, -1], [-1, -1]] }
sub module_generate_hash sub module_generate_hash
{ {

View File

@ -15,7 +15,7 @@ use Digest::SHA qw (sha1 sha256);
use Digest::HMAC qw (hmac); use Digest::HMAC qw (hmac);
use MIME::Base64 qw (encode_base64); use MIME::Base64 qw (encode_base64);
sub module_constraints { [[8, 63], [0, 32], [8, 63], [0, 32], [-1, -1]] } sub module_constraints { [[8, 63], [0, 32], [-1, -1], [-1, -1], [-1, -1]] }
sub module_generate_hash sub module_generate_hash
{ {

View File

@ -10,7 +10,7 @@ use warnings;
use Digest::MD5 qw (md5_hex); use Digest::MD5 qw (md5_hex);
sub module_constraints { [[0, 255], [30, 30], [0, 55], [30, 30], [-1, -1]] } sub module_constraints { [[-1, -1], [-1, -1], [0, 55], [30, 30], [-1, -1]] }
sub module_generate_hash sub module_generate_hash
{ {

View File

@ -10,7 +10,7 @@ use warnings;
use Authen::Passphrase::LANManager; use Authen::Passphrase::LANManager;
sub module_constraints { [[0, 7], [-1, -1], [0, 7], [-1, -1], [-1, -1]] } sub module_constraints { [[0, 7], [-1, -1], [-1, -1], [-1, -1], [-1, -1]] }
sub module_generate_hash sub module_generate_hash
{ {

View File

@ -10,7 +10,7 @@ use warnings;
use Crypt::CBC; use Crypt::CBC;
sub module_constraints { [[0, 30], [0, 30], [0, 30], [0, 30], [-1, -1]] } sub module_constraints { [[-1, -1], [-1, -1], [0, 30], [0, 30], [-1, -1]] }
sub module_generate_hash sub module_generate_hash
{ {

View File

@ -11,7 +11,7 @@ use warnings;
use Crypt::Eksblowfish::Bcrypt qw (bcrypt en_base64); use Crypt::Eksblowfish::Bcrypt qw (bcrypt en_base64);
use MIME::Base64 qw (decode_base64); use MIME::Base64 qw (decode_base64);
sub module_constraints { [[0, 72], [16, 16], [0, 72], [16, 16], [-1, -1]] } sub module_constraints { [[0, 72], [16, 16], [-1, -1], [-1, -1], [-1, -1]] }
sub module_generate_hash sub module_generate_hash
{ {

View File

@ -10,7 +10,7 @@ use warnings;
use Crypt::PBKDF2; use Crypt::PBKDF2;
sub module_constraints { [[0, 255], [16, 16], [0, 55], [16, 16], [0, 55]] } sub module_constraints { [[0, 255], [16, 16], [-1, -1], [-1, -1], [-1, -1]] }
sub module_generate_hash sub module_generate_hash
{ {

View File

@ -10,7 +10,7 @@ use warnings;
use Crypt::PBKDF2; use Crypt::PBKDF2;
sub module_constraints { [[0, 255], [16, 16], [0, 55], [16, 16], [0, 55]] } sub module_constraints { [[0, 255], [16, 16], [-1, -1], [-1, -1], [-1, -1]] }
sub module_generate_hash sub module_generate_hash
{ {

View File

@ -11,7 +11,7 @@ use warnings;
use Crypt::CBC; use Crypt::CBC;
use Crypt::PBKDF2; use Crypt::PBKDF2;
sub module_constraints { [[0, 255], [-1, -1], [0, 255], [-1, -1], [-1, -1]] } sub module_constraints { [[0, 255], [-1, -1], [-1, -1], [-1, -1], [-1, -1]] }
sub get_random_agilekeychain_salt sub get_random_agilekeychain_salt
{ {

View File

@ -10,7 +10,7 @@ use warnings;
use Crypt::PBKDF2; use Crypt::PBKDF2;
sub module_constraints { [[0, 255], [16, 16], [0, 255], [16, 16], [-1, -1]] } sub module_constraints { [[0, 255], [16, 16], [-1, -1], [-1, -1], [-1, -1]] }
sub to64 sub to64
{ {

View File

@ -11,7 +11,7 @@ use warnings;
use Crypt::CBC; use Crypt::CBC;
use Crypt::PBKDF2; use Crypt::PBKDF2;
sub module_constraints { [[0, 255], [1, 15], [0, 255], [1, 15], [-1, -1]] } sub module_constraints { [[0, 255], [1, 15], [-1, -1], [-1, -1], [-1, -1]] }
sub module_generate_hash sub module_generate_hash
{ {

View File

@ -10,7 +10,7 @@ use warnings;
use Digest::GOST qw (gost_hex); use Digest::GOST qw (gost_hex);
sub module_constraints { [[1, 32], [-1, -1], [1, 32], [-1, -1], [-1, -1]] } sub module_constraints { [[-1, -1], [-1, -1], [1, 32], [-1, -1], [-1, -1]] }
sub module_generate_hash sub module_generate_hash
{ {

View File

@ -10,7 +10,7 @@ use warnings;
use Crypt::PBKDF2; use Crypt::PBKDF2;
sub module_constraints { [[0, 255], [-1, -1], [0, 255], [-1, -1], [-1, -1]] } sub module_constraints { [[0, 255], [-1, -1], [-1, -1], [-1, -1], [-1, -1]] }
sub module_generate_hash sub module_generate_hash
{ {

View File

@ -10,7 +10,7 @@ use warnings;
use Crypt::PBKDF2; use Crypt::PBKDF2;
sub module_constraints { [[0, 255], [-1, -1], [0, 255], [-1, -1], [-1, -1]] } sub module_constraints { [[0, 255], [-1, -1], [-1, -1], [-1, -1], [-1, -1]] }
sub module_generate_hash sub module_generate_hash
{ {

View File

@ -11,7 +11,7 @@ use warnings;
use Convert::EBCDIC qw (ascii2ebcdic); use Convert::EBCDIC qw (ascii2ebcdic);
use Crypt::DES; use Crypt::DES;
sub module_constraints { [[1, 8], [1, 8], [1, 8], [1, 8], [-1, -1]] } sub module_constraints { [[1, 8], [1, 8], [-1, -1], [-1, -1], [-1, -1]] }
sub module_generate_hash sub module_generate_hash
{ {

View File

@ -10,7 +10,7 @@ use warnings;
use Digest::CRC qw (crc32); use Digest::CRC qw (crc32);
sub module_constraints { [[0, 255], [8, 8], [0, 31], [8, 8], [-1, -1]] } sub module_constraints { [[-1, -1], [-1, -1], [0, 31], [8, 8], [-1, -1]] }
sub module_generate_hash sub module_generate_hash
{ {

View File

@ -13,7 +13,7 @@ use Digest::CRC qw (crc32);
use Digest::SHA qw (sha256); use Digest::SHA qw (sha256);
use Encode; use Encode;
sub module_constraints { [[0, 255], [0, 16], [0, 27], [0, 16], [-1, -1]] } sub module_constraints { [[0, 255], [0, 16], [-1, -1], [-1, -1], [-1, -1]] }
sub module_generate_hash sub module_generate_hash
{ {

View File

@ -10,7 +10,7 @@ use warnings;
use Crypt::UnixCrypt_XS qw (crypt_rounds fold_password base64_to_int24 block_to_base64 int24_to_base64); use Crypt::UnixCrypt_XS qw (crypt_rounds fold_password base64_to_int24 block_to_base64 int24_to_base64);
sub module_constraints { [[1, 31], [4, 4], [1, 31], [4, 4], [-1, -1]] } sub module_constraints { [[1, 31], [4, 4], [-1, -1], [-1, -1], [-1, -1]] }
sub module_generate_hash sub module_generate_hash
{ {

View File

@ -10,7 +10,7 @@ use warnings;
use Crypt::PBKDF2; use Crypt::PBKDF2;
sub module_constraints { [[0, 255], [32, 32], [0, 55], [32, 32], [-1, -1]] } sub module_constraints { [[0, 255], [32, 32], [-1, -1], [-1, -1], [-1, -1]] }
sub module_generate_hash sub module_generate_hash
{ {

View File

@ -10,7 +10,7 @@ use warnings;
use Crypt::DES; use Crypt::DES;
sub module_constraints { [[8, 8], [16, 16], [8, 8], [16, 16], [-1, -1]] } sub module_constraints { [[8, 8], [16, 16], [-1, -1], [-1, -1], [-1, -1]] }
sub module_generate_hash sub module_generate_hash
{ {

View File

@ -10,7 +10,7 @@ use warnings;
use Crypt::DES; use Crypt::DES;
sub module_constraints { [[24, 24], [16, 16], [24, 24], [16, 16], [-1, -1]] } sub module_constraints { [[24, 24], [16, 16], [-1, -1], [-1, -1], [-1, -1]] }
sub module_generate_hash sub module_generate_hash
{ {

View File

@ -13,7 +13,7 @@ use Digest::MD4 qw (md4);
use Digest::SHA qw (sha1 hmac_sha1); use Digest::SHA qw (sha1 hmac_sha1);
use Encode; use Encode;
sub module_constraints { [[0, 255], [-1, -1], [0, 27], [-1, -1], [-1, -1]] } sub module_constraints { [[0, 255], [-1, -1], [-1, -1], [-1, -1], [-1, -1]] }
sub get_random_dpapimk_salt sub get_random_dpapimk_salt
{ {

View File

@ -11,7 +11,7 @@ use warnings;
use Crypt::PBKDF2; use Crypt::PBKDF2;
use Digest::Keccak qw (keccak_256_hex); use Digest::Keccak qw (keccak_256_hex);
sub module_constraints { [[0, 255], [32, 32], [0, 55], [32, 32], [-1, -1]] } sub module_constraints { [[0, 255], [32, 32], [-1, -1], [-1, -1], [-1, -1]] }
sub module_generate_hash sub module_generate_hash
{ {

View File

@ -11,7 +11,7 @@ use warnings;
use Crypt::ScryptKDF qw (scrypt_raw); use Crypt::ScryptKDF qw (scrypt_raw);
use Digest::Keccak qw (keccak_256_hex); use Digest::Keccak qw (keccak_256_hex);
sub module_constraints { [[0, 255], [32, 32], [0, 55], [32, 32], [-1, -1]] } sub module_constraints { [[0, 255], [32, 32], [-1, -1], [-1, -1], [-1, -1]] }
sub module_generate_hash sub module_generate_hash
{ {

View File

@ -14,7 +14,7 @@ use Digest::MD4 qw (md4);
use Digest::SHA qw (sha1 hmac_sha1 hmac_sha512); use Digest::SHA qw (sha1 hmac_sha1 hmac_sha512);
use Encode; use Encode;
sub module_constraints { [[0, 255], [-1, -1], [0, 27], [-1, -1], [-1, -1]] } sub module_constraints { [[0, 255], [-1, -1], [-1, -1], [-1, -1], [-1, -1]] }
sub get_random_dpapimk_salt sub get_random_dpapimk_salt
{ {

View File

@ -10,7 +10,7 @@ use warnings;
use Text::Iconv; use Text::Iconv;
sub module_constraints { [[1, 8], [-1, -1], [1, 8], [-1, -1], [-1, -1]] } sub module_constraints { [[1, 8], [-1, -1], [-1, -1], [-1, -1], [-1, -1]] }
sub module_generate_hash sub module_generate_hash
{ {

View File

@ -11,7 +11,7 @@ use warnings;
use Crypt::PBKDF2; use Crypt::PBKDF2;
use Crypt::Mode::ECB; use Crypt::Mode::ECB;
sub module_constraints { [[0, 255], [32, 32], [0, 55], [32, 32], [-1, -1]] } sub module_constraints { [[0, 255], [32, 32], [-1, -1], [-1, -1], [-1, -1]] }
sub module_generate_hash sub module_generate_hash
{ {

View File

@ -12,7 +12,7 @@ use Crypt::CBC;
use Crypt::PBKDF2; use Crypt::PBKDF2;
use Digest::Keccak qw (keccak_256_hex); use Digest::Keccak qw (keccak_256_hex);
sub module_constraints { [[0, 255], [40, 40], [0, 55], [40, 40], [-1, -1]] } sub module_constraints { [[0, 255], [40, 40], [-1, -1], [-1, -1], [-1, -1]] }
sub module_generate_hash sub module_generate_hash
{ {

View File

@ -13,7 +13,7 @@ use Digest::HMAC qw (hmac);
use MIME::Base64 qw (encode_base64url decode_base64url); use MIME::Base64 qw (encode_base64url decode_base64url);
use JSON qw (encode_json decode_json); use JSON qw (encode_json decode_json);
sub module_constraints { [[0, 64], [-1, -1], [0, 55], [-1, -1], [-1, -1]] } sub module_constraints { [[0, 64], [-1, -1], [-1, -1], [-1, -1], [-1, -1]] }
sub module_generate_hash sub module_generate_hash
{ {

View File

@ -11,7 +11,7 @@ use warnings;
use Crypt::PBKDF2; use Crypt::PBKDF2;
use Crypt::Mode::ECB; use Crypt::Mode::ECB;
sub module_constraints { [[0, 255], [32, 32], [0, 55], [32, 32], [-1, -1]] } sub module_constraints { [[0, 255], [32, 32], [-1, -1], [-1, -1], [-1, -1]] }
sub module_generate_hash sub module_generate_hash
{ {

View File

@ -12,7 +12,7 @@ use Crypt::PBKDF2;
use Digest::SHA qw (sha1); use Digest::SHA qw (sha1);
use Digest::HMAC qw (hmac_hex); use Digest::HMAC qw (hmac_hex);
sub module_constraints { [[8, 63], [-1, -1], [8, 63], [-1, -1], [-1, -1]] } sub module_constraints { [[8, 63], [-1, -1], [-1, -1], [-1, -1], [-1, -1]] }
sub module_generate_hash sub module_generate_hash
{ {

View File

@ -12,7 +12,7 @@ use Crypt::PBKDF2;
use Digest::HMAC qw (hmac_hex); use Digest::HMAC qw (hmac_hex);
use Digest::SHA qw (sha256); use Digest::SHA qw (sha256);
sub module_constraints { [[0, 255], [-1, -1], [0, 255], [-1, -1], [-1, -1]] } sub module_constraints { [[0, 255], [-1, -1], [-1, -1], [-1, -1], [-1, -1]] }
sub module_generate_hash sub module_generate_hash
{ {

View File

@ -10,7 +10,7 @@ use warnings;
use Digest::SHA3 qw (sha3_224_hex); use Digest::SHA3 qw (sha3_224_hex);
sub module_constraints { [[0, 255], [-1, -1], [0, 31], [-1, -1], [-1, -1]] } sub module_constraints { [[-1, -1], [-1, -1], [0, 31], [-1, -1], [-1, -1]] }
sub module_generate_hash sub module_generate_hash
{ {

View File

@ -10,7 +10,7 @@ use warnings;
use Digest::SHA3 qw (sha3_256_hex); use Digest::SHA3 qw (sha3_256_hex);
sub module_constraints { [[0, 255], [-1, -1], [0, 31], [-1, -1], [-1, -1]] } sub module_constraints { [[-1, -1], [-1, -1], [0, 31], [-1, -1], [-1, -1]] }
sub module_generate_hash sub module_generate_hash
{ {

View File

@ -10,7 +10,7 @@ use warnings;
use Digest::SHA3 qw (sha3_384_hex); use Digest::SHA3 qw (sha3_384_hex);
sub module_constraints { [[0, 255], [-1, -1], [0, 31], [-1, -1], [-1, -1]] } sub module_constraints { [[-1, -1], [-1, -1], [0, 31], [-1, -1], [-1, -1]] }
sub module_generate_hash sub module_generate_hash
{ {

View File

@ -10,7 +10,7 @@ use warnings;
use Digest::SHA3 qw (sha3_512_hex); use Digest::SHA3 qw (sha3_512_hex);
sub module_constraints { [[0, 255], [-1, -1], [0, 31], [-1, -1], [-1, -1]] } sub module_constraints { [[-1, -1], [-1, -1], [0, 31], [-1, -1], [-1, -1]] }
sub module_generate_hash sub module_generate_hash
{ {

View File

@ -10,7 +10,7 @@ use warnings;
use Digest::Keccak qw (keccak_224_hex); use Digest::Keccak qw (keccak_224_hex);
sub module_constraints { [[0, 255], [-1, -1], [0, 31], [-1, -1], [-1, -1]] } sub module_constraints { [[-1, -1], [-1, -1], [0, 31], [-1, -1], [-1, -1]] }
sub module_generate_hash sub module_generate_hash
{ {

View File

@ -10,7 +10,7 @@ use warnings;
use Digest::Keccak qw (keccak_256_hex); use Digest::Keccak qw (keccak_256_hex);
sub module_constraints { [[0, 255], [-1, -1], [0, 31], [-1, -1], [-1, -1]] } sub module_constraints { [[-1, -1], [-1, -1], [0, 31], [-1, -1], [-1, -1]] }
sub module_generate_hash sub module_generate_hash
{ {

View File

@ -10,7 +10,7 @@ use warnings;
use Digest::Keccak qw (keccak_384_hex); use Digest::Keccak qw (keccak_384_hex);
sub module_constraints { [[0, 255], [-1, -1], [0, 31], [-1, -1], [-1, -1]] } sub module_constraints { [[-1, -1], [-1, -1], [0, 31], [-1, -1], [-1, -1]] }
sub module_generate_hash sub module_generate_hash
{ {

View File

@ -10,7 +10,7 @@ use warnings;
use Digest::Keccak qw (keccak_512_hex); use Digest::Keccak qw (keccak_512_hex);
sub module_constraints { [[0, 255], [-1, -1], [0, 31], [-1, -1], [-1, -1]] } sub module_constraints { [[-1, -1], [-1, -1], [0, 31], [-1, -1], [-1, -1]] }
sub module_generate_hash sub module_generate_hash
{ {

View File

@ -11,7 +11,7 @@ use warnings;
use Digest::SHA qw (sha1); use Digest::SHA qw (sha1);
use Digest::HMAC qw (hmac_hex); use Digest::HMAC qw (hmac_hex);
sub module_constraints { [[0, 255], [8, 12], [0, 255], [8, 12], [-1, -1]] } sub module_constraints { [[0, 255], [8, 12], [-1, -1], [-1, -1], [-1, -1]] }
sub module_generate_hash sub module_generate_hash
{ {

View File

@ -11,7 +11,7 @@ use warnings;
use Crypt::Mode::ECB; use Crypt::Mode::ECB;
use Crypt::PBKDF2; use Crypt::PBKDF2;
sub module_constraints { [[0, 255], [-1, -1], [0, 255], [-1, -1], [-1, -1]] } sub module_constraints { [[0, 255], [-1, -1], [-1, -1], [-1, -1], [-1, -1]] }
sub module_generate_hash sub module_generate_hash
{ {

View File

@ -12,7 +12,7 @@ use Crypt::Mode::CBC;
use Crypt::PBKDF2; use Crypt::PBKDF2;
use Digest::SHA qw (sha256 sha256_hex); use Digest::SHA qw (sha256 sha256_hex);
sub module_constraints { [[0, 255], [32, 32], [0, 55], [32, 32], [-1, -1]] } sub module_constraints { [[0, 255], [32, 32], [-1, -1], [-1, -1], [-1, -1]] }
sub module_generate_hash sub module_generate_hash
{ {

View File

@ -11,7 +11,7 @@ use warnings;
use Digest::MD5 qw (md5_hex); use Digest::MD5 qw (md5_hex);
use Digest::SHA1 qw (sha1_hex); use Digest::SHA1 qw (sha1_hex);
sub module_constraints { [[0, 255], [-1, -1], [0, 55], [-1, -1], [-1, -1]] } sub module_constraints { [[0, 255], [-1, -1], [-1, -1], [-1, -1], [-1, -1]] }
sub module_generate_hash sub module_generate_hash
{ {

View File

@ -12,7 +12,7 @@ use Crypt::GCrypt;
use Crypt::PBKDF2; use Crypt::PBKDF2;
use Digest::SHA qw (sha1 sha1_hex); use Digest::SHA qw (sha1 sha1_hex);
sub module_constraints { [[0, 51], [32, 32], [0, 51], [32, 32], [-1, -1]] } sub module_constraints { [[0, 51], [32, 32], [-1, -1], [-1, -1], [-1, -1]] }
sub module_generate_hash sub module_generate_hash
{ {