# Cryptographic Hash

Posted onA cryptographic hash function is a hash function that satisfies the properties of pre-image resistance, second pre-image resistance and collision resistance. Here, a hash function is a mathematical algorithm that maps data of an arbitrary size (or “message”) to a bit array of a fixed size (the “hash value”, “hash”, or “message digest”), that is, a function that takes a string of any size as input and produces a fixed length value.

**Pre-image resistance**

Given a hash value `h`

, it should be difficult to find any message `m`

such that

`h = hash(m)`

**Second pre-image resistance (weak collision resistance)**

Given an input `m1`

, it should be difficult to find a different input `m2`

such that

`hash(m1) = hash(m2)`

**Collision resistance (strong collision resistance)**

It should be difficult to find two different messages `m1`

and `m2`

such that

`hash(m1) = hash(m2)`

A pair of messages that has the same hash value is called a cryptographic hash collision.