Take the 2-minute tour ×
Cryptography Stack Exchange is a question and answer site for software developers, mathematicians and others interested in cryptography. It's 100% free, no registration required.

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 ~] 
share|improve this question

marked as duplicate by D.W., Gilles, e-sushi, archie, rath Nov 25 '13 at 7:20

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

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. –  DrLecter Nov 22 '13 at 7:43
it seems that you are asking a way to solve this equation $H(**a***)=a$ –  T.B Nov 22 '13 at 7:56
Could you explain your motivation if you would like to do what Alex assumes? –  DrLecter Nov 22 '13 at 8:02
@DrLecter: good point :) –  newuser999 Nov 22 '13 at 8:08
See this question: crypto.stackexchange.com/questions/9910/… –  figlesquidge Nov 22 '13 at 10:35

1 Answer 1

up vote 2 down vote accepted

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

share|improve this answer
Kudos for giving an answer to the question as worded, and sorry that I initially missed that. –  fgrieu Nov 22 '13 at 21:50

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