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

pull/3725/head
Gabriele Gristina 11 months ago
parent 8652720ca9
commit 423faea47d

@ -13,10 +13,6 @@ use File::Basename;
use FindBin;
use List::Util 'shuffle';
# used by hash-mode 31500 and 31600
use Text::Iconv;
use Digest::MD4 qw (md4_hex);
# allows require by filename
use lib "$FindBin::Bin/test_modules";
@ -163,13 +159,6 @@ sub single
{
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);
# possible if the requested length is not supported by algorithm
@ -240,13 +229,6 @@ sub passthrough
$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);
next unless defined $hash;

@ -9,10 +9,22 @@ use strict;
use warnings;
use Digest::MD4 qw (md4_hex);
use Text::Iconv;
use Encode;
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
{
my $word = shift;

@ -10,10 +10,22 @@ use warnings;
use Digest::MD4 qw (md4);
use Crypt::PBKDF2;
use Text::Iconv;
use Encode;
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
{
my $word = shift;

Loading…
Cancel
Save