A **hash** is a **one way algorithm** used to **compare an input with a reference without compromising the reference.**

It is commonly used in logins to compare passwords and you can also find it on your reciepe if you shop using credit-card. There you will find your credit-card-number with some numbers hidden, this way you can prove *with high propability* that your card was used to buy the stuff while someone searching through your garbage won't be able to find the number of your card.

A very naive and simple hash is *"The first 3 letters of a string"*.
That means the hash of "abcdefg" will be "abc". This function can obviously not be reversed which is the entire purpose of a hash. However, note that "abcxyz" will have exactly the same hash, this is called a **collision**. So again: a **hash only proves with a certain propability that the two compared values are the same**.

Another very naive and simple hash is the 5-modulus of a number, here you will see that 6,11,16 etc.. will all have the same hash: 1.

Modern hash-algorithms are designed to keep the number of collisions as low as possible but they can never be completly avoided. A rule of thumb is: the longer your hash is, the less collisions it has.