Appearance

Hash Generator

/hash-generator/

Related tools

Comments

0/500

About this tool

Where hash values are used

A hash function turns data of any length into a short value of fixed length. The same input always gives the same value, and changing a single character produces a completely different one, so a hash works like a fingerprint for data. You can confirm that two files have the same content, or that a download was not corrupted or altered along the way, by comparing one short string instead of hundreds of megabytes.

Read moreShow less

The place most people meet hashes is a software download page. Pages for Linux installation images and developer tools often list a SHA-256 checksum, and the file you downloaded is the publisher's original only if its hash matches that value. In development, hashes are used for API signature checks, cache keys, finding duplicate files and integrity checks.

Enter text or choose a file and this hash generator shows five values at once: MD5, SHA-1, SHA-256, SHA-384 and SHA-512. With Uppercase on, you can compare directly against checksums written in capital letters.

How each hash algorithm is computed and how long the result is

SHA-1, SHA-256, SHA-384 and SHA-512 are computed with crypto.subtle.digest from the browser's built-in WebCrypto. WebCrypto has no MD5, so MD5 is implemented in JavaScript following the procedure in its specification, RFC 1321. Output lengths are 128 bits (32 hex characters) for MD5, 160 bits (40) for SHA-1, 256 bits (64) for SHA-256, 384 bits (96) for SHA-384 and 512 bits (128) for SHA-512. Each byte is shown as two hex digits.

Text is converted to UTF-8 bytes before hashing. The SHA-256 of abc is ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad, while Abc, with only the first letter capitalized, is 06d90109c8cce34ec0c776950465421e176f08b831a938b3c6e76cb7bee8790b, different from the very first digit. This spreading of a small input change across the whole output is called the avalanche effect. Even empty input has a fixed hash: the SHA-256 of nothing starts with e3b0c442 and the MD5 is d41d8cd98f00b204e9800998ecf8427e. Seeing one of these when comparing checksums is a sign that the file is empty.

MD5 was designed by Ronald Rivest in 1991, and SHA-1 was designed by the US National Security Agency and became a standard in 1995. SHA-256, SHA-384 and SHA-512 belong to the SHA-2 family, first published in 2001. SHA-384 uses the same 64-bit operations as SHA-512 with different initial values and keeps only the first 384 bits, so on 64-bit machines it can actually run faster than SHA-256.

Choosing a hash algorithm for your situation

To check a downloaded file, compare only the line for the algorithm listed on the download page. Most projects now use SHA-256, though older ones may list only MD5 or SHA-1. Files chosen on the File tab are only read on this device and never sent to a server.

Developers designing a new system can default to SHA-256 for integrity checks and identifiers. SHA-512 is a good choice when you want a longer output or handle large data on 64-bit servers. MD5 and SHA-1 are best kept for limited cases, such as compatibility with external systems that already use them, or finding duplicate files where security does not matter.

On the command line, Windows offers PowerShell's Get-FileHash or certutil -hashfile filename SHA256, macOS has shasum -a 256 filename and Linux has sha256sum filename, and matching results confirm both hashed the same bytes.

The limits of MD5 and SHA-1, and why hashes alone are wrong for passwords

For MD5 and SHA-1, methods for producing collisions, two different inputs with the same hash, are public. Xiaoyun Wang's team published real MD5 collisions in 2004, and the Flame malware discovered in 2012 used an MD5 collision to forge a certificate that looked like a Microsoft signature. For SHA-1, Google and the Dutch research institute CWI released two different PDFs with the same hash in 2017. Where an attacker can craft the files, matching MD5 or SHA-1 values alone do not prove two files are the same.

Using a plain hash to store passwords is also dangerous. The MD5 of password, 5f4dcc3b5aa765d61d8327deb882cf99, is so well known that a web search reveals the original. Hashes are designed to be fast, which makes them vulnerable to precomputed tables of common passwords and to mass guessing on graphics cards. Passwords should be stored with dedicated algorithms such as bcrypt, scrypt or Argon2, which are deliberately slow and mix in a different salt for each user.

A matching checksum means nothing if the page listing it was itself altered by an attacker, so compare important software against values obtained through a separately trusted channel, such as the official site over HTTPS or a GPG signature. The whole file is loaded into browser memory, so files of several gigabytes may fail or take long depending on the device, and MD5, computed in JavaScript, is slower than the other algorithms on large files.

FAQ

Is my file uploaded when I generate its hash?

No. The browser reads the file and computes the hash on this device without sending it to a server. Text input is likewise processed only on this device and is not saved; only your choice of Text or File and the Uppercase option are kept in this browser for next time.

Why is my hash different from another site's for the same text?

A single extra space or trailing newline changes the hash completely; abc and abc followed by a newline have different SHA-256 values. A different character encoding also changes the result, and this tool hashes text as UTF-8.

Can a hash be reversed to the original text?

A hash is a one-way calculation, so there is no mathematical way to reverse it. However, common text such as password can be looked up in precomputed tables, so the hash of a short or common value is effectively exposed.

How do I verify a SHA-256 checksum?

Choose the downloaded file on the File tab and compare the SHA-256 line with the value on the download page. If all 64 characters match, it is the same file. For a checksum written in capitals, turn on Uppercase before comparing.

Should I use MD5 or SHA-256?

For new uses, SHA-256. Ways to create MD5 collisions are known, so it cannot be trusted to detect tampering; keep it for compatibility with existing systems or simple duplicate checks.

Can I store passwords as SHA-256 hashes?

It is not recommended. SHA-256 is so fast to compute that it is vulnerable to mass guessing attacks. Use a password-specific algorithm such as bcrypt, scrypt or Argon2, which uses salts and is deliberately slow.