1
mirror of https://github.com/hashcat/hashcat synced 2024-11-28 05:21:38 +01:00

Add -m 7300 unit test

This commit is contained in:
jsteube 2019-02-15 21:13:54 +01:00
parent 6a387bf704
commit 179194a576

View File

@ -0,0 +1,58 @@
#!/usr/bin/env perl
##
## Author......: See docs/credits.txt
## License.....: MIT
##
use strict;
use warnings;
use Digest::HMAC qw (hmac_hex);
use Digest::SHA qw (sha1);
sub module_constraints { [[0, 255], [32, 255], [0, 55], [32, 32], [-1, -1]] }
sub module_generate_hash
{
my $word = shift;
my $salt = shift;
my $hash_buf = hmac_hex ($salt, $word, \&sha1);
my $hash = sprintf ("%s:%s", unpack ("H*", $salt), $hash_buf);
return $hash;
}
sub module_verify_hash
{
my $line = shift;
my $index1 = index ($line, ":");
return if $index1 < 1;
my $salt = substr ($line, 0, $index1);
$salt = pack ("H*", $salt);
my $rest = substr ($line, $index1 + 1);
my $index2 = index ($rest, ":");
return if $index2 < 1;
my $word = substr ($rest, $index2 + 1);
return unless defined $salt;
return unless defined $word;
$word = pack_if_HEX_notation ($word);
my $new_hash = module_generate_hash ($word, $salt);
return ($new_hash, $word);
}
1;