A hash (or hash digest) is a fixed-size string produced by a hash function from input data of any size. Hash functions are one-way mathematical functions — given any input you can instantly compute its hash, but you cannot reverse the process to recover the original data. The same input always produces the same output, and even a single character change causes a completely different result.
Want to compute a hash for a string or file?
Open Hash Generator →Hash functions trace their roots to 1953, when Hans Peter Luhn at IBM described one of the earliest hashing concepts for data retrieval. Cryptographic hashing emerged as a formal discipline in the 1970s alongside public-key cryptography. Key milestones include MD5 (1991, Ron Rivest), the SHA-1 standard (1995, NSA/NIST), and the SHA-2 family (2001, NSA/NIST) which introduced SHA-256 and SHA-512. In 2012, NIST standardized SHA-3 (Keccak) as an alternative with a completely different internal construction. For password hashing, bcrypt (1999, Niels Provos & David Mazières) introduced intentional slowness, and Argon2 won the Password Hashing Competition in 2015, adding memory-hardness against GPU attacks.
A hash function takes an input of any length and produces a fixed-length output (the digest). Four key properties define a cryptographic hash function:
SHA-256("hello") = 2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824
SHA-256("Hello") = 185f8db32921bd46d35b97f9c798b7d00b6c5fb5f0c2c3f0c3f2f1e2d1c0b9a8
SHA-256("") = e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
Designed by Ron Rivest in 1991. Produces a 128-bit (32 hex character) digest. MD5 is cryptographically broken — practical collision attacks have been demonstrated since 2004 and a forged SSL certificate was created using MD5 collisions in 2008. It should never be used for security purposes. Still acceptable for non-security checksums (e.g., verifying a file download hasn't been corrupted by transmission errors, not tampering).
MD5("hello") = 5d41402abc4b2a76b9719d911017c592
Published by NIST in 1995. Produces a 160-bit (40 hex character) digest. SHA-1 is deprecated for all security use — Google demonstrated a practical collision attack (SHAttered) in 2017. Browsers and certificate authorities have stopped accepting SHA-1 certificates. Git historically used SHA-1 for object IDs (now migrating to SHA-256).
SHA-1("hello") = aaf4c61ddcc5e8a2dabede0f3b482cd9aea9434d
Published by NIST in 2001. The SHA-2 family is the current standard for most cryptographic applications. SHA-256 produces a 256-bit (64 hex character) digest and is used in TLS certificates, Bitcoin mining, JWT signatures, and code signing. SHA-512 produces a 512-bit digest and is faster than SHA-256 on 64-bit hardware for large inputs.
SHA-256("hello") = 2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824
SHA-512("hello") = 9b71d224bd62f3785d96d46ad3ea3d73319bfbc2890caadae2dff72519673ca72323c3d99ba5c11d7c7acc6e14b8c5da0c4663475c2e5c3adef46f73bcdec043
Standardized by NIST in 2015 after a public competition. SHA-3 uses a fundamentally different internal construction (sponge function) compared to SHA-2's Merkle–Damgård construction. This means even if a weakness were found in SHA-2, SHA-3 would remain secure. SHA-3 is not faster than SHA-2 on most CPUs but provides an important alternative with independent security properties.
Designed specifically for password hashing in 1999 by Niels Provos and David Mazières. bcrypt automatically incorporates a random salt (preventing precomputed rainbow table attacks) and a configurable cost factor that controls how slow the function is. As hardware improves, you simply increase the cost factor. bcrypt output includes the salt and cost factor, so the hash is self-contained and portable.
bcrypt("password", cost=12) =
$2b$12$EXRkfkdmXn2gzds2SSitu.MW9.TNJjKVvljQQnqPDFT9cNBivgNS2
Winner of the Password Hashing Competition in 2015. Argon2 adds memory-hardness — an attacker needs a configurable amount of RAM in addition to CPU time, making GPU and ASIC brute-force attacks much more expensive. Three variants exist: Argon2d (GPU-resistant), Argon2i (side-channel-resistant), and Argon2id (hybrid — recommended for most use cases). Argon2 is the recommended choice for new applications.
HMAC (Hash-based Message Authentication Code) combines any hash function with a secret key to produce a message authentication code. HMAC verifies both data integrity (the message was not altered) and authenticity (only someone with the key could have produced it). HMAC-SHA256 is used in JWT HS256 signatures, API request signing, and webhook payload verification.
HMAC-SHA256(key="secret", message="hello") =
88aab3ede8d3adf94d26ab90d3bafd4a2083070c3bcce9c014ee04a443847c0b
A hash (or hash digest) is a fixed-size string produced by a hash function from input data of any size. Hash functions are one-way — you can compute the hash from the input, but you cannot reconstruct the input from the hash. The same input always produces the same output.
MD5 produces a 128-bit digest and is cryptographically broken — collision attacks have been demonstrated. SHA-256 is part of the SHA-2 family, produces a 256-bit digest, and remains secure for most purposes. Neither should be used alone to hash passwords; use bcrypt or Argon2 instead.
SHA-256 is designed to be fast, which makes it easy to brute-force — modern GPUs can compute billions of SHA-256 hashes per second. Password hashing algorithms like bcrypt and Argon2 are intentionally slow and include a random salt to prevent precomputed rainbow table attacks.
Both are designed for password hashing and include salting. bcrypt (1999) has a configurable cost factor controlling speed. Argon2 (2015) adds memory-hardness — attackers need large amounts of RAM in addition to CPU time, making GPU and ASIC attacks much more expensive. Argon2id is the recommended choice for new systems.
A hash collision occurs when two different inputs produce the same hash output. A secure hash function makes it computationally infeasible to find such collisions. MD5 and SHA-1 are broken because practical collisions have been demonstrated; SHA-256 and SHA-3 remain collision-resistant.
HMAC (Hash-based Message Authentication Code) combines a hash function with a secret key to produce a message authentication code. It verifies both data integrity and authenticity. HMAC-SHA256 is used in JWT HS256 signatures, API request signing, and webhook verification.