From ae360d8dcaa56d37c707daa74f604c2dad081d06 Mon Sep 17 00:00:00 2001 From: jsteube Date: Wed, 20 Feb 2019 14:18:15 +0100 Subject: [PATCH] Make sure in test.pl to output always at least 8 passwords --- tools/test.pl | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/tools/test.pl b/tools/test.pl index 0d098f78e..353d584e3 100755 --- a/tools/test.pl +++ b/tools/test.pl @@ -346,6 +346,8 @@ sub init_db_word_rand for (my $len = $len_min; $len <= $len_max; $len++) { + next if ($len == 0); + push @pool, $len; } @@ -356,16 +358,16 @@ sub init_db_word_rand push @pool, $pool[0]; } - my $db_out; + @pool = shuffle (@pool); - my $idx = 0; + my $db_out; - $db_out->[$idx++] = $len_min; - $db_out->[$idx++] = $len_max; + $db_out->[0] = $len_min; + $db_out->[1] = $len_max; - for ($idx .. $single_outputs) + for (my $idx = 2; $idx < $single_outputs; $idx++) { - $db_out->[$idx++] = shift @pool; + $db_out->[$idx] = shift @pool; } # make sure the password length is only increasing, which is important for test.sh in -a 1 mode to work @@ -398,6 +400,8 @@ sub init_db_salt_rand for (my $len = $len_min; $len <= $len_max; $len++) { + next if ($len == 0); + push @pool, $len; } @@ -408,16 +412,16 @@ sub init_db_salt_rand push @pool, $pool[0]; } - my $db_out; + @pool = shuffle (@pool); - my $idx = 0; + my $db_out; - $db_out->[$idx++] = $len_min; - $db_out->[$idx++] = $len_max; + $db_out->[0] = $len_min; + $db_out->[1] = $len_max; - for ($idx .. $single_outputs) + for (my $idx = 2; $idx < $single_outputs; $idx++) { - $db_out->[$idx++] = shift @pool; + $db_out->[$idx] = shift @pool; } @{$db_out} = sort { length $b <=> length $a } @{$db_out};