Cryptographic Hash Function
Also known as: Hash function, Message digest
Function that maps data of any size to a fixed-length digest in a way that is practically impossible to reverse or to match with different input.
A cryptographic hash function takes an input of any length, whether a password, a document or an entire disk image, and produces a fixed-length output called a hash or digest. The same input always yields the same digest, but even a tiny change to the input produces a completely different result. To be secure, a hash function must resist three things: finding an input that matches a given digest (preimage resistance), finding a second input with the same digest as a known one and finding any two inputs that collide.
Widely used families include MD5 and SHA-1, both considered broken for security purposes, and the SHA-2 and SHA-3 families standardized by NIST. Researchers demonstrated practical MD5 collisions in 2004, and in 2017 Google and the CWI Amsterdam research institute published the first practical SHA-1 collision, known as SHAttered. SHA-3, based on the Keccak algorithm, was standardized in 2015 after a public competition. BLAKE2 and BLAKE3 are fast alternatives used in many open-source projects.
Hashes are building blocks throughout security. They verify that downloaded files have not been altered, underpin digital signatures and message authentication codes, link blocks in a blockchain and structure data in a Merkle tree. For password storage, fast general-purpose hashes are unsuitable on their own; systems should use deliberately slow, salted password-hashing functions such as bcrypt, scrypt or Argon2 to resist brute-force guessing. In digital forensics, hash values document that evidence has not changed since it was collected.
Key points
- A hash function turns any input into a fixed-length digest that changes completely if the input changes.
- Secure hashes resist preimage, second-preimage and collision attacks.
- MD5 and SHA-1 are broken for security use; SHA-2, SHA-3 and the BLAKE family are preferred.
- Passwords should be stored with slow, salted algorithms such as bcrypt, scrypt or Argon2.
Related entries
Digital Signature
Cryptographic mechanism that lets anyone verify who created a digital message or file and confirm that it has not been altered since it was signed.
Merkle Tree
Tree data structure in which each non-leaf node holds a hash of its children, enabling efficient and secure verification of large data sets.
Blockchain
Append-only ledger made of blocks of records linked by cryptographic hashes and replicated across a network that agrees on updates by consensus.
Proof of Work
Technique in which participants prove they spent computing effort by finding a value whose hash meets a difficulty target, used in many blockchains.
Password Manager
Software that generates, stores and fills strong, unique passwords and other secrets in an encrypted vault protected by one master credential.
Digital Forensics
Branch of forensic science that recovers, preserves and analyzes data from computers, phones and networks to investigate incidents and support legal cases.
Encryption
The process of transforming readable data into ciphertext so that only parties holding the correct key can recover and understand it.
Public-Key Cryptography
Cryptographic system that uses pairs of linked keys, one public and one private, to enable encryption and digital signatures between strangers.
Featured in guides
Referenced by
Other entries that discuss or point to Cryptographic Hash Function.