1
$\begingroup$

My colleague remembers and old backup tool, packaged as a standard bootable ISO image. He thinks the file was about ~250 MB, containing a MD5SUM.txt, which included the MD5 Checksum of the entire ISO image.

I am no crypto/hash expert, but according to my understanding of checksum methods, he is wrong. He should have downloaded checksum separately, or else, the vendor should have had a hard time guessing the right MD5 such that adding it's hex form in a text file beside all other contents of the image makes the exact same checksum, right? I can't think of any shortcut to calculate such checksum.

(Unfortunately we don't have the ISO right now, so that I can win the bet and get a free beer.)

$\endgroup$
2
$\begingroup$

With a secure hash function what you are describing is entirely impossible. MD5 is considered totally broken and yet I am unaware of a method of accomplishing this feat even with known multi collision attacks.
SEJPM gave a relevant link to what can be done with multi collision attacks on MD5 but placing the resulting hash in plain text is harder and I don't believe has been done. Definitely didn't happen as a matter of fact implementation detail. Should someone do this even with MD5 it would be a significant cryptography feat.

In order to demonstrate that with a turing complete format it is easy to have a file produce its own hash with no need for cryptanalysis: I created a proof of concept and wrote a Scala program which prints its own SHA-256 hash. This technique can work with any hash function, and any turing complete language, including postscript https://gist.githubusercontent.com/meirmaor/3d858568d5da35f568fe96687ed7dbaf/raw/c26d3bdd298567e76e92c6c37ab96e353a3d8cdf/QuineHash.scala

scalac QuineHash.scala
scala QuineHash 6bae798a607d1f74630734435cc93d17c9b92a6705f7663c6fd47f7439c69669

sha256sum QuineHash.scala 6bae798a607d1f74630734435cc93d17c9b92a6705f7663c6fd47f7439c69669 QuineHash.scala

| improve this answer | |
$\endgroup$
  • $\begingroup$ Indeed. However we can make a pdf file that shows the hash of the iso. $\endgroup$ – fgrieu Dec 23 '17 at 16:55
  • $\begingroup$ With a Turing complete format like postscript we don't need any cryptography for this. Just calculate your own hash and display it, this will require quine like tricks no cryptanalasis. I'm half tempted to try this with SHA-2/3 $\endgroup$ – Meir Maor Dec 23 '17 at 17:42
  • $\begingroup$ @MeirMaor But... How do you calculate your own hash, when you are made up of your own hash? $\endgroup$ – sorush-r Dec 23 '17 at 18:14
  • $\begingroup$ It shoulnd't be harder then a program which prints itself: en.wikipedia.org/wiki/Quine_(computing) $\endgroup$ – Meir Maor Dec 23 '17 at 18:17
  • $\begingroup$ @MeirMaor: I see no way to make a pdf/postscript/executable that displays the sha256 of the iso it was extracted from. $\endgroup$ – fgrieu Dec 23 '17 at 19:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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