1
0
mirror of https://github.com/hashcat/hashcat.git synced 2024-11-22 08:08:10 +00:00

cleanup test.pl and implement module_get_random_password() in 31500/31600 test modules

This commit is contained in:
Gabriele Gristina 2023-05-18 21:38:14 +02:00
parent 8652720ca9
commit 423faea47d
3 changed files with 24 additions and 18 deletions

View File

@ -13,10 +13,6 @@ use File::Basename;
use FindBin; use FindBin;
use List::Util 'shuffle'; use List::Util 'shuffle';
# used by hash-mode 31500 and 31600
use Text::Iconv;
use Digest::MD4 qw (md4_hex);
# allows require by filename # allows require by filename
use lib "$FindBin::Bin/test_modules"; use lib "$FindBin::Bin/test_modules";
@ -163,13 +159,6 @@ sub single
{ {
for my $salt (sort { length $a <=> length $b } keys %{$db_prev->{$word}}) for my $salt (sort { length $a <=> length $b } keys %{$db_prev->{$word}})
{ {
if ($MODE == 31500 || $MODE == 31600)
{
my $converter = Text::Iconv->new('utf8', 'UTF-16LE');
$word = md4_hex ($converter->convert ($word));
}
my $hash = module_generate_hash ($word, $salt); my $hash = module_generate_hash ($word, $salt);
# possible if the requested length is not supported by algorithm # possible if the requested length is not supported by algorithm
@ -240,13 +229,6 @@ sub passthrough
$idx++; $idx++;
if ($MODE == 31500 || $MODE == 31600)
{
my $converter = Text::Iconv->new('utf8', 'UTF-16LE');
$word = md4_hex ($converter->convert ($word));
}
my $hash = module_generate_hash ($word, $salt); my $hash = module_generate_hash ($word, $salt);
next unless defined $hash; next unless defined $hash;

View File

@ -9,10 +9,22 @@ use strict;
use warnings; use warnings;
use Digest::MD4 qw (md4_hex); use Digest::MD4 qw (md4_hex);
use Text::Iconv;
use Encode; use Encode;
sub module_constraints { [[32, 32], [0, 256], [-1, -1], [-1, -1], [-1, -1]] } sub module_constraints { [[32, 32], [0, 256], [-1, -1], [-1, -1], [-1, -1]] }
sub module_get_random_password
{
my $word = shift;
my $converter = Text::Iconv->new('utf8', 'UTF-16LE');
$word = md4_hex ($converter->convert ($word));
return $word;
}
sub module_generate_hash sub module_generate_hash
{ {
my $word = shift; my $word = shift;

View File

@ -10,10 +10,22 @@ use warnings;
use Digest::MD4 qw (md4); use Digest::MD4 qw (md4);
use Crypt::PBKDF2; use Crypt::PBKDF2;
use Text::Iconv;
use Encode; use Encode;
sub module_constraints { [[32, 32], [0, 256], [-1, -1], [-1, -1], [-1, -1]] } sub module_constraints { [[32, 32], [0, 256], [-1, -1], [-1, -1], [-1, -1]] }
sub module_get_random_password
{
my $word = shift;
my $converter = Text::Iconv->new('utf8', 'UTF-16LE');
$word = md4_hex ($converter->convert ($word));
return $word;
}
sub module_generate_hash sub module_generate_hash
{ {
my $word = shift; my $word = shift;