0

I've often heard that hash functions cant be reversed with the analogy of :take a number and add all the digits together, ex: 412 => 7 but you cant get your original value (412) back from 7. While this does make sense wouldnt it also imply that there are multiple inputs that give the same output?

1 Answers1

0

A hash function is a versatile one-way cryptographic algorithm that maps an input of any size to a unique output of a fixed length of bits. The resulting output, which is known as a hash digest, hash value, or hash code, is the resulting unique identifier.

So answering your question: Yes, multiple inputs can give the same output if and only if the inputs are exactly the same. The analogy(take a number and add all the digits together) does not satisfy the part of the definition that states, that even if the pattern of characters/numbers is changed the hash created will be completely different.

Even if something tiny changed in an input — you capitalize a letter instead of using one that’s lowercase, or you swap an exclamation mark where there was a period — it’s going to result in the generation of an entirely new hash value and that’s the whole idea here — no matter how big or small a change, a completely different hash value gets created.

Att Coder
  • 43
  • 3
  • *...A hash function is a versatile one-way cryptographic algorithm...* There are non-cryptographic hashes. *...Yes, multiple inputs can give the same output if and only if the inputs are exactly the same...* No.No.No. – President James K. Polk May 30 '22 at 10:55
  • President James K. Polk what no no no? Do you have any explanation? – Att Coder May 30 '22 at 11:23
  • Except for very special cases like perfect hash functions, hash functions are many-to-one: there are many distinct inputs that map to a given output. – President James K. Polk May 30 '22 at 13:19
  • For hash functions with an output smaller than the input you‘ll always have the possibility of hash collisions. – seb May 30 '22 at 15:21