# Brute force and birthday attack

Brute force and birthday attack

The principle of brute forcing is to try all the possible outputs. For example in order to get a collision you would set a script which tries lots of possible input into the hash function in order to get the same output (a collision).

This attack is quite slow and impossible to use in reality against most of cryptographic hash functions. A form a Brute force attack is the Birthday attack, it is based on the birthday problem in math. It says that if you try random inputs you get a higher likelihood to find collisions. In average you can find one in **2 ^{n/2}** tries, with n the length in bits of the output from the hash function. Besides it is interesting to note that a fast hash algorithm is not always a good thing, since you will make the work of the hackers easier: they will go faster to brute force and make more tries per seconds.