m25400.pm should no longer recalculate $u

pull/2877/head
Your Name 3 years ago
parent 4934e92cda
commit c91b61e237

@ -171,6 +171,10 @@ sub module_generate_hash
################ 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 $digest = md5 ($padding . pack ("H*", $id));
@ -196,7 +200,12 @@ sub module_generate_hash
$u = $m2->RC4 ($u);
}
$u .= substr (pack ("H*", $u_save), 16, 16);
}
else
{
$u = pack("H*", $u)
}
################ OWNER PASSWORD #################
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));
$u .= substr (pack ("H*", $u_save), 16, 16);
#printf("\$o = %s\n", unpack ("H*", $o));
#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));
print("hash\n".$hash."\n");
return $hash;
}

Loading…
Cancel
Save