1
0
mirror of https://github.com/hashcat/hashcat.git synced 2024-10-31 20:48:57 +00:00

Merge pull request #3316 from philsmd/27800_unit_tests

add tests for -m 27800 = MurmurHash 3
This commit is contained in:
Jens Steube 2022-06-11 18:28:19 +02:00 committed by GitHub
commit b80eaf8796
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 53 additions and 1 deletions

View File

@ -48,6 +48,7 @@ cpan install Authen::Passphrase::LANManager \
Digest::Keccak \
Digest::MD4 \
Digest::MD5 \
Digest::MurmurHash3 \
Digest::Perl::MD5 \
Digest::SHA \
Digest::SHA1 \

View File

@ -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"

View 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;