Hash Generator

Developer

SHA-256, SHA-384, SHA-512 and HMAC, computed in your browser.

Digest
d7a8fbb307d7809469ca9abcb0082e4f8d5651e46d3cdb762d02d0bf37c9e592
256-bit digest of 43 bytes
Digest bits256
Input bytes43
Characters43
All three
SHA-256 · 256 bits
d7a8fbb307d7809469ca9abcb0082e4f8d5651e46d3cdb762d02d0bf37c9e592
SHA-384 · 384 bits
ca737f1014a48f4c0b6dd43cb177b0afd9e5169367544c494011e3317dbf9a509cb1e5dc1e85a941bbee3d7f2afbc9b1
SHA-512 · 512 bits
07e547d9586f6a73f73fbac0435ed76951218fb7d0c8d788a309d785436bbb642e93a252a954f23912547d1e8a3b5ed6e1bfd7097821233fa0538f3db854fee6
A plain hash is not a message authentication code. Anyone can compute one, so it proves a file has not changed, never who produced it. Use HMAC with a shared key for that.

How to use

What it's for

Make a hash — a fixed-length fingerprint of a piece of text that changes completely if even one character changes — to check two texts match, or because a system asks for one.

Before you start

Have the text ready, and the hash you were given if you are checking one. For a downloaded file, use the File Checksum tool instead.

  1. Paste the text

    Type or paste into Text to hash, replacing the sample. Every character counts, including a space or line break at the end.

  2. Choose the algorithm

    Under Algorithm, pick SHA-256, SHA-384 or SHA-512 — whichever you were asked for. SHA-256 is the one most often wanted.

  3. Choose a plain hash or an HMAC

    Leave Mode on Plain hash unless you were asked for an HMAC, which is a hash made with a secret key so it also proves who made it. For that, choose HMAC (keyed) and type the key into Secret key.

  4. Pick how it is written

    Under Output as, keep Hexadecimal (only 0–9 and a–f) unless you were asked for Base64.

  5. Generate, then copy or compare

    Press Generate to bring the hash into view, then Copy to take it. To check one you were given, look under All three — one of the lines should match it exactly.

Reading the result

  • Digest: the hash of your text (it reads HMAC in HMAC mode). The line under it gives its size in bits and how many bytes were hashed.
  • Digest bits: the size of the hash, set by the algorithm.
  • Input bytes and Characters: how much text was hashed. They differ when the text has a character such as ñ or ₱, which takes more than one byte.
  • All three: your text under all three algorithms, so you can tell which one made a hash you were given.

If it goes wrong

  • Your hash does not match one made elsewhere: look for a space or line break at the end of the text — a note warns when the text ends in whitespace. One extra character changes the whole hash.
  • An error says An HMAC needs a key: type the key into Secret key, or set Mode back to Plain hash.
  • You were asked for MD5 or SHA-1: this page does not offer them, because both are broken for checking data. Ask whether SHA-256 will do.

What this is

A hash is a function of BYTES, not of letters. So "the SHA-256 of a string" means nothing until an encoding is named — here it is always UTF-8. The peso sign is one character and three bytes, which is why this page reports both counts.

That is also behind the commonest mismatch: a trailing newline. echo hello sends six bytes, not five, so it hashed a different input. Check the byte count first whenever a value does not match one from elsewhere.

A hash and an HMAC do different jobs. A hash proves data has not changed. Anyone can compute a SHA-256, so if an attacker can alter the data they can recompute the digest to match. An HMAC needs a secret key, and that is what makes it evidence of who produced it.

Questions

Why does my digest differ from the one sha256sum gives?

Almost always a trailing newline. `echo hello` sends “hello\n” — six bytes, not five — so the two digests are of different inputs and will never match. Use `echo -n` or `printf`, or paste the text here without the newline. This page reports the byte count beside the digest so the difference is visible rather than mysterious.

Which encoding is the text hashed in?

UTF-8. A hash is a function of bytes, not of characters, so “the SHA-256 of a string” is meaningless until an encoding is named. It matters the moment the text is not plain ASCII: the peso sign is one character and three bytes. The page shows both counts for that reason.

What is the difference between a hash and an HMAC?

A plain hash proves that data has not changed. An HMAC proves who produced it, because computing one requires a secret key. Anyone can compute a SHA-256, so a bare digest authenticates nothing — if an attacker can change the data they can recompute the digest to match.

Why not just hash the key and the message together?

Because SHA-256 is vulnerable to length extension: knowing the hash of a secret plus a message lets an attacker compute the hash of that secret plus a longer message, without ever learning the secret. HMAC’s nested construction is what closes it, and that is the whole reason it exists rather than being an arbitrary convention.

Why is there no MD5 or SHA-1?

Both are broken for anything that depends on collisions being hard, and both are still the first thing people reach for. Offering them beside SHA-2 would present them as a matter of taste. Verifying a legacy checksum somebody else produced is a real need and it is not enough of one to ship a broken primitive here.

What happens to what I type?

Nothing leaves your browser. The hash functions are written out in this site’s own calculation engine — not called over a network, and not taken from a third-party library — so the text you paste is never transmitted, logged or stored.

Are these implementations correct?

They are checked against the published test vectors rather than against themselves. SHA-256, SHA-384 and SHA-512 are verified against FIPS 180-4, including the million-byte case, and the HMAC construction against RFC 4231 — whose case 6 covers the rule most hand-written HMACs miss, that a key longer than the block is hashed rather than truncated.

The maths

The three, and their digest sizes
SHA-256256 bits · 64 hex
SHA-384384 bits · 96 hex
SHA-512512 bits · 128 hex

SHA-384 is not SHA-512 truncated. They start from different initial values, so lopping 48 bytes off a SHA-512 digest gives a different and wrong answer.

A key longer than the block

In HMAC, a key longer than the algorithm block is hashed down first, never truncated. It is the single most commonly missed line in a hand-written HMAC — and missing it lets two different long keys produce the same MAC. RFC 4231 case 6 exists to catch exactly that, and this implementation is tested against it.

Keep going

Important

Computed in your browser and never transmitted. The implementations are verified against the FIPS 180-4 and RFC 4231 test vectors, but a digest is only as meaningful as the bytes you gave it — check the byte count if a value does not match one from elsewhere. Nothing you type here is sent to our servers — the calculation runs entirely in your browser.