mirror of
https://github.com/hashcat/hashcat.git
synced 2024-11-22 16:18:09 +00:00
Add -m 13300 unit test
This commit is contained in:
parent
eccd93a200
commit
f36549cf75
65
tools/test_modules/m13300.pm
Normal file
65
tools/test_modules/m13300.pm
Normal file
@ -0,0 +1,65 @@
|
||||
#!/usr/bin/env perl
|
||||
|
||||
##
|
||||
## Author......: See docs/credits.txt
|
||||
## License.....: MIT
|
||||
##
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use Digest::SHA qw (sha1_hex);
|
||||
|
||||
sub module_constraints { [[0, 255], [-1, -1], [0, 55], [-1, -1], [-1, -1]] }
|
||||
|
||||
sub module_generate_hash
|
||||
{
|
||||
my $word = shift;
|
||||
my $salt = shift;
|
||||
my $param = shift;
|
||||
|
||||
my $length = 32;
|
||||
|
||||
if ($param)
|
||||
{
|
||||
$length = $param;
|
||||
}
|
||||
|
||||
my $hash_buf = sha1_hex ($word);
|
||||
|
||||
my $hash = sprintf ('$axcrypt_sha1$%s', substr ($hash_buf, 0, $length));
|
||||
|
||||
return $hash;
|
||||
}
|
||||
|
||||
sub module_verify_hash
|
||||
{
|
||||
my $line = shift;
|
||||
|
||||
my ($hash_in, $word) = split ":", $line;
|
||||
|
||||
next unless defined $hash_in;
|
||||
next unless defined $word;
|
||||
|
||||
my @data = split ('\$', $hash_in);
|
||||
|
||||
next unless scalar @data == 3;
|
||||
|
||||
shift @data;
|
||||
|
||||
my $signature = shift @data;
|
||||
my $digest = shift @data;
|
||||
|
||||
my $param = length ($digest);
|
||||
|
||||
next unless ($signature eq 'axcrypt_sha1');
|
||||
next unless (($param == 32) || ($param == 40));
|
||||
|
||||
$word = pack_if_HEX_notation ($word);
|
||||
|
||||
my $new_hash = module_generate_hash ($word, undef, $param);
|
||||
|
||||
return ($new_hash, $word);
|
||||
}
|
||||
|
||||
1;
|
Loading…
Reference in New Issue
Block a user