I know it sounds strange.. but, are there any ways in practice to put the hash of a PDF file in the PDF file? And after geting the hash in the PDF file - if someone would do a hash check of the PDF file, the hash would be the same as the one that is already in the PDF file? :) maybe with MD5, since it's known to have weaknesses? Example:

[user@notebook ~] wget -q http://renyi.hu/~csirmaz/nws06/xajanlo.ps -O Md5-xajanlo.ps; wget -q http://renyi.hu/~csirmaz/nws06/xutasit.ps -O Md5-xutasit.ps; md5sum Md5-xajanlo.ps; md5sum Md5-xutasit.ps; sha512sum Md5-xajanlo.ps; sha512sum Md5-xutasit.ps; rm Md5-xajanlo.ps Md5-xutasit.ps
583bdceb34826c38ac7f1fdac3aca807  Md5-xajanlo.ps
583bdceb34826c38ac7f1fdac3aca807  Md5-xutasit.ps
c82d26f77ccd4597622fc985d4220aedad6f866555c6db82db2d6d17e22016268a3e88d0b0cd89a8e536ae7d666c446edeb77edef2fca783739e4bff9d7032be  Md5-xajanlo.ps
205c18b396bee84995d8c325787600ca88ca3d9758c4dfe89cdaa242ab9513710057c5fce55afb2c6ef3117703be7c31266a1fa6fbac1f369b82f0719587c60c  Md5-xutasit.ps
[user@notebook ~] 
  • $\begingroup$ And what happens if i simply modify the pdf and replace the hash that you have put into the pdf file accordingly? ;) I guess signing the pdf file is what you are looking for. $\endgroup$
    – DrLecter
    Nov 22, 2013 at 7:43
  • 3
    $\begingroup$ it seems that you are asking a way to solve this equation $H(**a***)=a$ $\endgroup$
    – T.B
    Nov 22, 2013 at 7:56
  • $\begingroup$ Could you explain your motivation if you would like to do what Alex assumes? $\endgroup$
    – DrLecter
    Nov 22, 2013 at 8:02
  • $\begingroup$ @DrLecter: good point :) $\endgroup$
    – newuser999
    Nov 22, 2013 at 8:08
  • 1
    $\begingroup$ See this question: crypto.stackexchange.com/questions/9910/… $\endgroup$ Nov 22, 2013 at 10:35

1 Answer 1


You cannot push the hash of a file 'in' the file, as newly modified file will have a different new hash....

As said, it seems that you are asking a way to solve this equation H(∗∗a∗∗∗)=a

  • 1
    $\begingroup$ Kudos for giving an answer to the question as worded, and sorry that I initially missed that. $\endgroup$
    – fgrieu
    Nov 22, 2013 at 21:50

Not the answer you're looking for? Browse other questions tagged or ask your own question.