Given a hash function (lets suppose 128bit output), there exists some collisions, at least if the input length is greater than the output.

Provided also that the hash function is meant to operate in full binary (block) mode.

Is the chance of a collision altered if we limit the input to be hashed to only alphanumeric characters (subset of the full binary range) ? Is that dependent on the hashing function algorithm ?

Context: A MD5 function is used to hash some text.

If an attacker wants to alter the text without being identified, he can only use text chatacters (lets suppose a-Z).

Is it any harder or easier (than full binary) to forge a different text which produces the same hash value ?

What if the input length of the original and forged messages cannot be more than a certain factor (so no unlimited length to forge a message) ?

  • 1
    It should not change much. Note that the recent SHA1 collision created valid PDF documents. For sure there is some possibility that a limited alphabet will reduce the likelyhood of a collision but finding any hints of that would amount to an attack on the hash function on its own (you need to know more of the structure of the output than should be possible) – Christoph Egger Oct 30 at 10:24
  • I agree @ChristophEgger but is it not because the PDF header indeed accepts binary and can be skipped with a simple offset !? – Simon Oct 30 at 12:23

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.