1
0
mirror of https://github.com/hashcat/hashcat.git synced 2024-12-23 07:08:19 +00:00

Guarantee output of 8 entries in single mode in test.pl

This commit is contained in:
jsteube 2019-01-03 13:19:36 +01:00
parent 0baf8fc2f9
commit 620bd693c5

View File

@ -65,8 +65,6 @@ sub single
# fallback to incrementing length
undef $len unless is_count ($len);
my $format = "echo %-31s | ./hashcat \${OPTS} -a 0 -m %d '%s'\n";
my $word_min = ($IS_OPTIMIZED == 1) ? $constraints->[2]->[0] : $constraints->[0]->[0];
my $word_max = ($IS_OPTIMIZED == 1) ? $constraints->[2]->[1] : $constraints->[0]->[1];
my $salt_min = ($IS_OPTIMIZED == 1) ? $constraints->[3]->[0] : $constraints->[1]->[0];
@ -96,7 +94,7 @@ sub single
}
else
{
$word_len = $db_word_len->[$idx];
$word_len = $db_word_len->[$giveup % $single_outputs];
}
my $salt_len = 0;
@ -138,13 +136,21 @@ sub single
$db_prev->{$word}->{$salt} = undef;
$idx++;
}
my $hash = module_generate_hash ($word, $salt);
for my $word (sort { length $a <=> length $b } keys %{$db_prev})
{
for my $salt (sort { length $a <=> length $b } keys %{$db_prev->{$word}})
{
my $hash = module_generate_hash ($word, $salt);
# possible if the requested length is not supported by algorithm
next unless defined $hash;
# possible if the requested length is not supported by algorithm
next unless defined $hash;
printf ($format, $word, $MODE, $hash);
my $format = "echo %-31s | ./hashcat \${OPTS} -a 0 -m %d '%s'\n";
printf ($format, $word, $MODE, $hash);
}
}
}