Overview
Hashing is a one-directional mathematical operation which is quick to calculate, yet hard to reverse. Common uses include password storage and digital signatures. Even a small change in the input results in a very different hash, meaning that it functions as an efficient and consistent way to check if two copies of data or software match. Typically, the operation works on a block of input data; the hash output is then hashed with the next block, creating a new hash reflecting everything to that point; this action is repeated until the hash reflects everything through the final block.
Cryptographic hash functions have many information-security applications, notably in digital signatures, message authentication codes (MACs), and other forms of authentication. They can also be used as ordinary hash functions, to index data in hash tables, for fingerprinting, to detect duplicate data or uniquely identify files, and as checksums to detect accidental data corruption.
Indeed, in information-security contexts, cryptographic hash values are sometimes called (digital) fingerprints, checksums, (message) digests, or just hash values, even though all these terms stand for more general functions with rather different properties and purposes.
Non-cryptographic hash functions are used in hash tables and to detect accidental errors; their constructions frequently provide no resistance to a deliberate attack. For example, a denial-of-service attack on hash tables is possible if the collisions are easy to find, as in the case of linear cyclic redundancy check (CRC) functions.
6 sources for this section
- 1Cryptographic hash function — Wikipedia, revision 1376105477
- 2"Introduction to key usage in integrated firmware images". Intel.com. Retrieved July 18, 2026.
- 3"What is Hashing?". Codeacademy.com. Mar 27, 2025. Retrieved July 18, 2026.
- 4"Testing and Review Process". New York State Board of Elections. Retrieved July 18, 2026.
- 5"message digest". Computer Security Resource Center - Glossary. NIST.
- 6Schneier, Bruce. "Cryptanalysis of MD5 and SHA: Time for a New Standard". Computerworld. Archived from the original on 2016-03-16. Retrieved 2016-04-20. Much more than encryption algorithms, one-way hash functions are the workhorses of modern cryptography.
Properties
Most cryptographic hash functions are designed to take a string of any length as input and produce a fixed-length hash value.
Collision resistance implies second pre-image resistance but does not imply pre-image resistance. The weaker assumption is always preferred in theoretical cryptography, but in practice, a hash-function that is only second pre-image resistant is considered insecure and is therefore not recommended for real applications.
Informally, these properties mean that a malicious adversary cannot replace or modify the input data without changing its digest. Thus, if two strings have the same digest, one can be very confident that they are identical. Second pre-image resistance prevents an attacker from crafting a document with the same hash as a document the attacker cannot control. Collision resistance prevents an attacker from creating two distinct documents with the same hash.
1 source for this section
Degree of difficulty
In cryptographic practice, "difficult" generally means "almost certainly beyond the reach of any adversary who must be prevented from breaking the system for as long as the security of the system is deemed important". The meaning of the term is therefore somewhat dependent on the application since the effort that a malicious agent may put into the task is usually proportional to their expected gain. However, since the needed effort usually multiplies with the digest length, even a thousand-fold advantage in processing power can be neutralized by adding a dozen bits to the latter.
For messages selected from a limited set of messages, for example passwords or other short messages, it can be feasible to invert a hash by trying all possible messages in the set. Because cryptographic hash functions are typically designed to be computed quickly, special key derivation functions that require greater computing resources have been developed that make such brute-force attacks more difficult.
In some theoretical analyses "difficult" has a specific mathematical meaning, such as "not solvable in asymptotic polynomial time". Such interpretations of difficulty are important in the study of provably secure cryptographic hash functions but do not usually have a strong connection to practical security. For example, an exponential-time algorithm can sometimes still be fast enough to make a feasible attack. Conversely, a polynomial-time algorithm (e.g., one that requires n^(20) steps for n-digit keys) may be too slow for any practical use.
1 source for this section
Illustration
An illustration of the potential use of a cryptographic hash is as follows: Alice poses a tough math problem to Bob and claims that she has solved it. Bob would like to try it himself, but would yet like to be sure that Alice is not bluffing. Therefore, Alice writes down her solution, computes its hash, and tells Bob the hash value (whilst keeping the solution secret). Then, when Bob comes up with the solution himself a few days later, Alice can prove that she had the solution earlier by revealing it and having Bob hash it and then check that it matches the hash value given to him before.
(This is an example of a simple commitment scheme; in actual practice, Alice and Bob will often be computer programs, and the secret would be something less easily spoofed than a claimed puzzle solution.)
1 source for this section
Verifying the integrity of messages and files
An important application of secure hashes is the verification of message integrity. Comparing message digests (hash digests over the message) calculated before, and after, transmission can determine whether any changes have been made to the message or file.
MD5, SHA-1, or SHA-2 hash digests are sometimes published on websites or forums to allow verification of integrity for downloaded files, including files retrieved using file sharing such as mirroring. This practice establishes a chain of trust as long as the hashes are posted on a trusted site – usually the originating site – authenticated by HTTPS. Using a cryptographic hash and a chain of trust detects malicious changes to the file.
Non-cryptographic error-detecting codes such as cyclic redundancy checks only prevent against non-malicious alterations of the file, since an intentional spoof can readily be crafted to have the colliding code value.
The source notesEvidence & further reading7 sources
- Cryptographic hash function — Wikipedia, revision 1376105477 Wikipedia contributors · Reference source · accessed 2026-09-22
- "Introduction to key usage in integrated firmware images". Intel.com. Retrieved July 18, 2026. intel.com · Reference source · link imported 2026-09-22
- "What is Hashing?". Codeacademy.com. Mar 27, 2025. Retrieved July 18, 2026. codecademy.com · Reference source · link imported 2026-09-22
- "Testing and Review Process". New York State Board of Elections. Retrieved July 18, 2026. elections.ny.gov · Reference source · link imported 2026-09-22
- "message digest". Computer Security Resource Center - Glossary. NIST. csrc.nist.gov · Reference source · link imported 2026-09-22
- Schneier, Bruce. "Cryptanalysis of MD5 and SHA: Time for a New Standard". Computerworld. Archived from the original on 2016-03-16. Retrieved 2016-04-20. Much more than encryption algorithms, one-way hash functions are the workhorses of modern cryptography. schneier.com · Reference source · link imported 2026-09-22
- Perrin, Chad (December 5, 2007). "Use MD5 hashes to verify software downloads". TechRepublic. Archived from the original on October 18, 2012. Retrieved March 2, 2013. techrepublic.com · Reference source · link imported 2026-09-22