# When are hash functions considered insecure?

I'd like to know when a hash function is considered insecure. Clearly, if it is easy to invert then it's not secure at all. Apart from that, let's say I've found a bunch of inputs $x_1, x_2, .. ,x_n$ s.t their hashes are equal. Would this mean my hash function is insecure even though $n$ is much smaller than my input space?

In general, when is a hash function considered insecure?

The security level of a cryptographic hash function has been defined using the following properties:

• Pre-image resistance

Given a hash value $$h$$ it should be difficult to find any message $$m$$ such that $$h = hash(m)$$. This concept is related to that of one-way function. Functions that lack this property are vulnerable to preimage attacks.

• Second pre-image resistance

Given an input $$m_1$$ it should be difficult to find different input $$m_2$$ such that $$hash(m_1) = hash(m_2)$$. Functions that lack this property are vulnerable to second-preimage attacks.

• Collision resistance

It should be difficult to find two different messages $$m_1$$ and $$m_2$$ such that $$hash(m_1) = hash(m_2)$$. Such a pair is called a cryptographic hash collision. This property is sometimes referred to as strong collision resistance. It requires a hash value at least twice as long as that required for preimage-resistance; otherwise collisions may be found by a birthday attack.

More details are in here.