Hash text
Hash text using various algorithms like MD5, SHA1, SHA256, SHA512
TL;DR
What is Hash text?
A cryptographic hash function takes an input of any length and produces a fixed-length output called a digest or checksum. The same input always produces the same output, but even a one-character change produces a completely different hash. Hash functions are one-way: you cannot recover the original input from the hash.
Common use cases
- ‣File integrity: compare checksums before and after a download to detect corruption or tampering
- ‣Content-addressable keys: generate cache keys, ETags, or deduplication fingerprints from file content
- ‣Data fingerprinting: store a hash of a value to check equality later without keeping the original
- ‣Commit and artifact identification: Git uses SHA-1 (and now SHA-256) to identify every commit and object
Frequently asked questions
Which algorithm should I use?
SHA-256 is the safe default for most purposes. MD5 and SHA-1 are cryptographically broken (practical collision attacks exist) and should not be used for security-critical work. They are only acceptable for non-security checksums where speed matters more than collision resistance.
Can I use SHA-256 to store passwords?
No. SHA-256 is too fast: modern hardware can compute billions of hashes per second, making brute-force and dictionary attacks practical. Use bcrypt, scrypt, or Argon2 for passwords. These are intentionally slow and include a salt to prevent precomputed attacks.
What is a collision?
A collision is when two different inputs produce the same hash. MD5 and SHA-1 have known practical collision attacks, meaning an attacker can craft a second file with the same checksum as a legitimate one. SHA-256 has no known collisions and is considered collision-resistant for the foreseeable future.
See also
- ‣Bcrypt: for hashing passwords specifically, bcrypt is the correct choice: SHA-256 is too fast for password storage and lacks a built-in salt
- ‣HMAC generator: add a secret key to a hash to prove authenticity using HMAC, which prevents an attacker from forging a valid digest
- ‣Encrypt / decrypt text: combine hashing with encryption to verify data integrity after decryption