1
0
mirror of https://github.com/hashcat/hashcat.git synced 2024-11-22 16:18:09 +00:00

fixes #2840: minor code style changes for OpenEdge tests

This commit is contained in:
philsmd 2021-06-22 10:40:24 +02:00 committed by GitHub
parent 6c670136c4
commit af95a63d40
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -41,14 +41,19 @@ sub PE_encode
my @target = (0) x 16; my @target = (0) x 16;
my $hash = 17; my $hash = 17;
for (my $i=0; $i<5; $i++) { for (my $i = 0; $i < 5; $i++)
for (my $j=0; $j<$word_str_len; $j++) { {
for (my $j = 0; $j < $word_str_len; $j++)
{
my $idx = 15 - ($j % 16); my $idx = 15 - ($j % 16);
$scratch[$idx] ^= ord ($word[$j]); $scratch[$idx] ^= ord ($word[$j]);
} }
for (my $j=0; $j<16; $j+=2) { for (my $j = 0; $j < 16; $j += 2)
for (my $k=15; $k>=0; $k--) { {
for (my $k = 15; $k >= 0; $k--)
{
$hash = (($hash & 0xffff) >> 8 ^ $PE_CONST[($hash & 0xff)] ^ $PE_CONST[$scratch[$k]]); $hash = (($hash & 0xffff) >> 8 ^ $PE_CONST[($hash & 0xff)] ^ $PE_CONST[$scratch[$k]]);
} }
@ -57,20 +62,27 @@ sub PE_encode
} }
} }
my $low; for (my $i = 0; $i < 16; $i++)
for (my $i=0; $i<16; $i++) { {
$low = $scratch[$i] & 0x7f; my $low = $scratch[$i] & 0x7f;
if ($low >= 65 && $low <= 90 || $low >= 97 && $low <= 122) { if ($low >= 65 && $low <= 90)
{
$target[$i] = $low; $target[$i] = $low;
} else { }
elsif ($low >= 97 && $low <= 122)
{
$target[$i] = $low;
}
else
{
$target[$i] = ((($scratch[$i] & 0xff) >> 4) + 0x61) & 0xff; $target[$i] = ((($scratch[$i] & 0xff) >> 4) + 0x61) & 0xff;
} }
$target[$i] = chr ($target[$i]); $target[$i] = chr ($target[$i]);
} }
return join '', @target; return join ('', @target);
} }
sub module_generate_hash sub module_generate_hash