1
0
mirror of https://github.com/hashcat/hashcat.git synced 2024-11-21 23:58:07 +00:00

Add -m 8500 unit test

This commit is contained in:
jsteube 2019-02-17 15:49:57 +01:00
parent a677920fd8
commit ac5bcd89fa

View File

@ -11,48 +11,7 @@ use warnings;
use Convert::EBCDIC qw (ascii2ebcdic);
use Crypt::DES;
sub module_constraints { [[1, 8], [1, 8], [-1, -1], [-1, -1], [-1, -1]] }
sub module_generate_hash
{
my $word = shift;
my $salt = shift;
my $hash_buf = racf_hash (uc $salt, $word);
my $tmp_hash = sprintf ('$racf$*%s*%s', uc $salt, uc $hash_buf);
return $tmp_hash;
}
sub module_verify_hash
{
my $line = shift;
my @line_elements = split (":", $line);
return if scalar @line_elements < 2;
# get hash and word
my $hash_in = shift @line_elements;
my $word = join (":", @line_elements);
# get signature
my @hash_elements = split ('\*', $hash_in);
return unless ($hash_elements[0] eq '$racf$');
my $salt = $hash_elements[1];
my $word_packed = pack_if_HEX_notation ($word);
my $new_hash = module_generate_hash ($word_packed, $salt);
return ($new_hash, $word);
}
sub module_constraints { [[0, 8], [1, 8], [-1, -1], [-1, -1], [-1, -1]] }
sub racf_hash
{
@ -85,4 +44,46 @@ sub racf_hash
return $ct;
}
sub module_generate_hash
{
my $word = shift;
my $salt = shift;
my $hash_buf = racf_hash (uc $salt, $word);
my $hash = sprintf ('$racf$*%s*%s', uc $salt, uc $hash_buf);
return $hash;
}
sub module_verify_hash
{
my $line = shift;
my @line_elements = split (":", $line);
return if scalar @line_elements < 2;
my $hash_in = shift @line_elements;
my $word = join (":", @line_elements);
# check signature
my @hash_elements = split ('\*', $hash_in);
return unless ($hash_elements[0] eq '$racf$');
my $salt = $hash_elements[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;