> For the complete documentation index, see [llms.txt](https://zer0verflow.gitbook.io/ecpptv2-notes/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://zer0verflow.gitbook.io/ecpptv2-notes/system-security/cryptography-and-password-cracking/cryptography-hash-function.md).

# Cryptography Hash Function

### 2. Cryptography Hash Function

A cryptographic hash function is a deterministic algorithm that produces a fixed length block of bits from a variable length input message. The output is usually called has or digest. The most famous hash function is MD5, MD4, SHA1, and SHA2.

Properties of hash functions:

* Preimage resistance\
  &#x20;It should be infeasible to find a message that has a given hash
* Second preimage resistance\
  &#x20;Given an input message, it should be infeasible to find another message with the same hash
* Collision resistance\
  &#x20;It should be infeasible to find two different messages with the same hash

Almost all cryptographic hashes and ciphers have what is called an Avalanche effect. This means that a single bit changed in that message will cause a vast change in the final input.
