Hash Generator

Generate cryptographic hashes (SHA-1, SHA-256, SHA-512) from any text. Uses the Web Crypto API.

What is a hash?

A cryptographic hash function turns any input - a word, a document, a disk image - into a fixed-length string of characters. The same input always produces the same hash, but the process only runs one way: you cannot recover the input from the hash.

That one-way property is what makes hashes useful. They act as a compact fingerprint for data, letting you verify that something has not changed without needing the original to compare against.

Key takeaways

  • Hashing is one-way and is not encryption - there is no key and no way back.
  • The same input always gives the same hash; one changed bit changes everything.
  • MD5 and SHA-1 are broken and must not be used for security.
  • SHA-256 is the sensible default for integrity checking.
  • None of these are suitable for storing passwords - use Argon2, scrypt or bcrypt.

The algorithms compared

AlgorithmOutput lengthStatusUse it for
MD5128 bits (32 hex)Broken since 2004Non-security checksums only
SHA-1160 bits (40 hex)Broken since 2017Legacy compatibility only
SHA-256256 bits (64 hex)SecureThe general-purpose default
SHA-512512 bits (128 hex)SecureWhere a longer digest is wanted

SHA-512 is often faster than SHA-256 on 64-bit hardware despite producing a longer output, because it operates on 64-bit words natively.

What "broken" means here. MD5 and SHA-1 are broken in the sense that researchers can construct two different inputs producing the same hash - a collision - at practical cost. This defeats any use where a hash is meant to prove a document is the one you expect. Both remain adequate for detecting accidental corruption, such as a failed download.

The avalanche effect

A good hash function changes completely when the input changes even slightly. Hashing "hello" and "hellp" - one letter different - produces two entirely unrelated SHA-256 outputs with roughly half the bits differing.

This is exactly what makes hashes useful for integrity checking. You cannot tell from two hashes whether the inputs were similar, and any change to a file - a single flipped bit - produces an obviously different fingerprint.

What hashes are legitimately used for

  • File integrity verification. Compare a downloaded file's hash against the publisher's to confirm it arrived intact and unaltered.
  • Detecting duplicate files by fingerprint rather than by comparing contents byte by byte.
  • Digital signatures, where a document's hash is signed rather than the whole document.
  • Blockchain and version control. Git identifies every commit by a hash of its contents.
  • Deduplication in storage and backup systems.
  • Cache keys and content-addressed storage.

Why you must not hash passwords with these

MD5, SHA-1, SHA-256 and SHA-512 are all wrong for passwords. They are designed to be fast, and speed is exactly the property an attacker wants. A modern GPU can compute billions of SHA-256 hashes per second, so a stolen database of SHA-256 password hashes falls quickly to a dictionary attack. Use Argon2id, scrypt or bcrypt - functions deliberately designed to be slow and memory-hard.
FunctionDesigned forGuesses per second on a GPU
SHA-256SpeedAround 10 billion
bcrypt (cost 12)SlownessAround 20 thousand
scryptSlowness + memory costSimilar to bcrypt
Argon2idSlowness + memory + parallelism costAround 2 thousand

The difference is roughly a million-fold. That is the gap between a password database being cracked overnight and being effectively uncrackable.

Rainbow tables and salting

A rainbow table is a precomputed lookup of hashes for common inputs. Because the same input always produces the same hash, an unsalted hash of a common password can simply be looked up rather than cracked.

A salt is a unique random value added to each input before hashing. It means identical passwords produce different hashes, which makes precomputed tables useless - each password must be attacked individually. Modern password hashing functions handle salting automatically.

Verifying a downloaded file

  1. Find the publisher's official checksum, ideally on a different domain or channel from the download itself.
  2. Compute the hash of your downloaded file using your operating system's built-in tool.
  3. Compare the two strings carefully - check the whole string, not just the first few characters.
  4. If they differ, do not run the file. It is either corrupted or has been tampered with.
PlatformCommand
Windows (PowerShell)Get-FileHash file.zip -Algorithm SHA256
macOSshasum -a 256 file.zip
Linuxsha256sum file.zip
A checksum on the same page as the download proves very little. Anyone who can replace the file can usually replace the checksum next to it. Checksums are most meaningful when published separately, signed with a key you already trust, or provided over a different channel.
Everything runs in your browser. This tool is implemented entirely in client-side JavaScript. Nothing you enter is transmitted to a server, logged or stored, which matters a great deal for anything security-related. You can verify this yourself by opening your browser's network tab and watching it stay empty while you work.

Frequently Asked Questions

What is a hash function?

A function that converts any input into a fixed-length string of characters. The same input always produces the same output, but the process is one-way - you cannot recover the input from the hash. It acts as a compact fingerprint for data.

Can a hash be reversed or decrypted?

No. Hashing is not encryption and has no key. What attackers actually do is guess inputs, hash them, and compare - which works well for short or common inputs but not for long random ones. There is no mathematical way back.

Which hash algorithm should I use?

SHA-256 for general-purpose integrity checking. SHA-512 if you want a longer digest, and it is often faster on 64-bit hardware. Avoid MD5 and SHA-1 for anything security-related, though they remain fine for detecting accidental file corruption.

Why are MD5 and SHA-1 considered broken?

Because researchers can construct two different inputs that produce the same hash, at practical cost - MD5 since 2004 and SHA-1 since 2017. That defeats any use where the hash is meant to prove a document is the one you expect.

Can I use SHA-256 to store passwords?

No. SHA-256 is designed to be fast, and a modern GPU computes billions of them per second, so a stolen database falls quickly to a dictionary attack. Use Argon2id, scrypt or bcrypt, which are deliberately slow and memory-hard.

What is a salt?

A unique random value added to each input before hashing, so that identical passwords produce different hashes. It defeats rainbow tables - precomputed hash lookups - by forcing each password to be attacked individually. Modern password hashing functions salt automatically.

Why does changing one character change the whole hash?

This is the avalanche effect, and it is a deliberate design property. A single-bit change to the input flips roughly half the output bits. It means you cannot infer anything about input similarity from hash similarity, and any file change is immediately obvious.

How do I verify a downloaded file with a hash?

Compute the file's hash with your operating system's tool - Get-FileHash on Windows, shasum on macOS, sha256sum on Linux - and compare it with the publisher's published value. Compare the entire string, and do not run the file if they differ.

Is my input sent to a server when I hash it here?

No. Hashing runs entirely in your browser using the Web Crypto API. Nothing is transmitted, logged or stored.

Related Calculators