mirror of
https://github.com/hashcat/hashcat.git
synced 2024-12-22 22:58:30 +00:00
Merge pull request #3316 from philsmd/27800_unit_tests
add tests for -m 27800 = MurmurHash 3
This commit is contained in:
commit
b80eaf8796
@ -48,6 +48,7 @@ cpan install Authen::Passphrase::LANManager \
|
||||
Digest::Keccak \
|
||||
Digest::MD4 \
|
||||
Digest::MD5 \
|
||||
Digest::MurmurHash3 \
|
||||
Digest::Perl::MD5 \
|
||||
Digest::SHA \
|
||||
Digest::SHA1 \
|
||||
|
@ -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"
|
||||
|
51
tools/test_modules/m27800.pm
Normal file
51
tools/test_modules/m27800.pm
Normal file
@ -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;
|
Loading…
Reference in New Issue
Block a user