Introduction
A cryptographic hash function reduces an input of arbitrary length to a fixed-size digest. Hashes identify downloaded files, protect signed messages, organize content-addressed storage, commit data in blockchains and support many authentication constructions.
The same word is also used for non-cryptographic hash tables, but security hashes have stronger requirements. The utily.tools Hash Generator calculates MD5 and SHA-family digests for text, making algorithm and output differences visible.
One-way compression with security properties
A secure hash aims for preimage resistance, second-preimage resistance and collision resistance. Given a digest, finding an input should be infeasible; given one input, finding another with the same digest should be infeasible; and finding any colliding pair should require roughly the square root of the output space because of the birthday bound.
Avalanche behavior means a tiny input change produces an apparently unrelated digest. Determinism means the same bytes always produce the same result. Hashes are not encryption because there is no key and no supported reverse operation.
Technical foundations and behavior
Hash algorithms pad the message, process fixed-size blocks through a compression function and update an internal state. The final state becomes the digest. SHA-256 emits 256 bits, usually written as 64 hexadecimal characters.
Algorithm status
MD5 and SHA-1 have practical collision attacks and should not protect digital signatures or adversarial integrity. They remain useful only for compatibility or non-security fingerprints. SHA-256, SHA-384 and SHA-512 are members of SHA-2 and remain standard choices.
Bytes and representation
The algorithm hashes bytes, not the visual idea of text. UTF-8 encoding, newline style and Unicode normalization affect the digest. Hexadecimal and Base64 are only representations of the same output bytes.
Passwords and authenticity
Fast hashes are unsuitable for password storage because attackers can test guesses rapidly; use Argon2, scrypt, bcrypt or PBKDF2 with salts and policy. A plain hash also cannot prove who produced a message; HMAC or a digital signature adds keyed authenticity.
Real-world applications
Download verification
A publisher distributes a SHA-256 digest through a trusted channel so users can detect corrupted or replaced artifacts.
Content-addressed storage
Systems use a digest as the object key so identical content deduplicates and modification produces a new address.
Digital signatures
Signature algorithms normally sign a cryptographic digest rather than processing an arbitrarily large message directly.
Standards and deeper technical reference
Security properties and attack cost
A cryptographic hash maps arbitrary bytes to a fixed-size digest. Preimage resistance makes it difficult to find a message for a chosen digest; second-preimage resistance protects a fixed message from replacement; collision resistance makes finding any two equal-digest messages difficult. For an ideal n-bit hash, generic preimage work is about 2^n and collision work about 2^(n/2).
The avalanche effect describes output sensitivity but does not prove those security properties. A checksum can detect accidental errors without resisting a malicious attacker. A bare hash also provides no authenticity because anyone who changes a file can recompute it.
| Algorithm | Digest | Standard and status |
|---|---|---|
| MD5 | 128 bits | RFC 1321; practical collisions, prohibited for signatures and adversarial integrity |
| SHA-1 | 160 bits | Formerly FIPS 180; practical collisions, phased out for digital signatures |
| SHA-256 | 256 bits | SHA-2 in FIPS 180-4; widely recommended general-purpose hash |
| SHA-384 | 384 bits | SHA-2 derived from the SHA-512 design with a truncated output |
| SHA-512 | 512 bits | SHA-2 using 64-bit words and 1024-bit blocks |
| SHA3-256 / 512 | 256 / 512 bits | FIPS 202 Keccak sponge construction, structurally different from SHA-2 |
Merkle-Damgård, sponge construction and length extension
MD5, SHA-1 and SHA-2 use iterative compression over padded blocks. Publishing H(secret || message) with these hashes can enable a length-extension attack because the digest exposes the internal chaining state. HMAC avoids this problem through a proven inner and outer keyed construction.
SHA-3 uses a sponge: data is absorbed into a permutation state and output is squeezed from it. SHAKE128 and SHAKE256 are extendable-output functions whose output length is chosen by the application. SHA-3 supplements rather than simply versioning SHA-2.
Correct hashing workflows
Hash bytes, not an ambiguous visual string. Declare UTF-8 for text and normalize only when the protocol calls for it. Stream large files incrementally. When publishing a software checksum, deliver the expected digest through an authenticated channel or sign a release manifest.
Passwords require a deliberately slow, salted password hashing function such as Argon2, scrypt, bcrypt or an approved PBKDF, not a fast SHA digest. Message authentication requires HMAC or another MAC. Digital signatures hash as part of a signature scheme but add private-key authenticity.
Primary specifications and references
Conclusion
Cryptographic hashes create deterministic fixed-length fingerprints with one-way and collision-resistance goals. Algorithm age and context determine whether a digest is merely convenient or genuinely secure.
My practical recommendation is SHA-256 as the general default, with dedicated password hashing and HMAC where those properties are required. Compare algorithms in the utily.tools Hash Generator and read the HMAC and certificate articles for the next layer of authenticity.
