# Difficulty of generating a string “The (md5|sha1) hash of this string is (x)” that hashes to (x) vs. regular hash collision between files?

I know that collisions in md5 and sha1 have been demonstrated in particular pairs of files (by incrementing some none viewable portion of a PDF, etc).

Would generating the above string be meaningfully more computationally difficult than generating such a collision?

However, we can easily construct a family of $2^{128}$ octet strings all with the same MD5 hash that are valid PDF documents and display any desired 128-bit value in hexadecimal, including one such document (that we can exhibit) displaying its own hash. That also works for Postscript, non-signed executables.. It would be feasible to do this for SHA-1, but that would cost about 128 times more work than what was used for one collision.