1
0
mirror of https://github.com/hashcat/hashcat.git synced 2025-07-15 11:08:21 +00:00

m25400.pm should no longer recalculate $u

This commit is contained in:
Your Name 2021-07-06 00:58:39 +02:00
parent 4934e92cda
commit c91b61e237

View File

@ -171,6 +171,10 @@ sub module_generate_hash
################ USER PASSWORD ################# ################ USER PASSWORD #################
# do not change $u if it exists, keep this the same, as we don't know the user password,
# we cannot calculate this part of the hash again
if("".$u eq "0000000000000000000000000000000000000000000000000000000000000000")
{
my $res = pdf_compute_encryption_key_user($word, $padding, $id, $u, $o, $P, $V, $R, $enc); my $res = pdf_compute_encryption_key_user($word, $padding, $id, $u, $o, $P, $V, $R, $enc);
my $digest = md5 ($padding . pack ("H*", $id)); my $digest = md5 ($padding . pack ("H*", $id));
@ -196,7 +200,12 @@ sub module_generate_hash
$u = $m2->RC4 ($u); $u = $m2->RC4 ($u);
} }
$u .= substr (pack ("H*", $u_save), 16, 16);
}
else
{
$u = pack("H*", $u)
}
################ OWNER PASSWORD ################# ################ OWNER PASSWORD #################
my $o_key = pdf_compute_encryption_key_owner($word, $padding, $id, $u, $o, $P, $V, $R, $enc); my $o_key = pdf_compute_encryption_key_owner($word, $padding, $id, $u, $o, $P, $V, $R, $enc);
@ -228,14 +237,11 @@ sub module_generate_hash
} }
#printf("\$u = %s\n", unpack ("H*", $u)); #printf("\$u = %s\n", unpack ("H*", $u));
$u .= substr (pack ("H*", $u_save), 16, 16);
#printf("\$o = %s\n", unpack ("H*", $o)); #printf("\$o = %s\n", unpack ("H*", $o));
#printf("\$u = %s\n", unpack ("H*", $u)); #printf("\$u = %s\n", unpack ("H*", $u));
my $hash = sprintf ('$pdf$%d*%d*128*%d*%d*16*%s*32*%s*32*%s', $V, $R, $P, $enc, $id, unpack ("H*", $u), unpack ("H*", $o)); my $hash = sprintf ('$pdf$%d*%d*128*%d*%d*16*%s*32*%s*32*%s', $V, $R, $P, $enc, $id, unpack ("H*", $u), unpack ("H*", $o));
print("hash\n".$hash."\n");
return $hash; return $hash;
} }