1
0
mirror of https://github.com/hashcat/hashcat.git synced 2024-11-26 18:08:20 +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 # fallback to incrementing length
undef $len unless is_count ($len); 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_min = ($IS_OPTIMIZED == 1) ? $constraints->[2]->[0] : $constraints->[0]->[0];
my $word_max = ($IS_OPTIMIZED == 1) ? $constraints->[2]->[1] : $constraints->[0]->[1]; my $word_max = ($IS_OPTIMIZED == 1) ? $constraints->[2]->[1] : $constraints->[0]->[1];
my $salt_min = ($IS_OPTIMIZED == 1) ? $constraints->[3]->[0] : $constraints->[1]->[0]; my $salt_min = ($IS_OPTIMIZED == 1) ? $constraints->[3]->[0] : $constraints->[1]->[0];
@ -96,7 +94,7 @@ sub single
} }
else else
{ {
$word_len = $db_word_len->[$idx]; $word_len = $db_word_len->[$giveup % $single_outputs];
} }
my $salt_len = 0; my $salt_len = 0;
@ -138,15 +136,23 @@ sub single
$db_prev->{$word}->{$salt} = undef; $db_prev->{$word}->{$salt} = undef;
$idx++; $idx++;
}
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); 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
next unless defined $hash; next unless defined $hash;
my $format = "echo %-31s | ./hashcat \${OPTS} -a 0 -m %d '%s'\n";
printf ($format, $word, $MODE, $hash); printf ($format, $word, $MODE, $hash);
} }
} }
}
sub passthrough sub passthrough
{ {