Hash Generator

Compute SHA-1/256/384/512 and MD5 digests

Runs in your browserUtility03Encoding & Crypto

What is Hash Generator?

A hash generator that produces MD5, SHA-1, SHA-256, SHA-384, and SHA-512 digests for any text, useful for verifying that a file arrived intact or comparing a value against a published checksum. It uses the native Web Crypto API, so the input never leaves your machine.

How to use Hash Generator

  1. 1Enter the text you want to digest.
  2. 2Read the hexadecimal result for each algorithm, and copy any single row on its own.
  3. 3Compare it character by character with the digest you were given; case does not affect the comparison.
  4. 4For a keyed signature rather than a plain digest, use the HMAC tool instead.

How do I do this in code?

Use the tool above for one-off work; for anything you repeat, move it into a script or your project.

const sha256 = async (text) => {
  const buf = await crypto.subtle.digest(
    'SHA-256',
    new TextEncoder().encode(text),
  );
  return [...new Uint8Array(buf)]
    .map((b) => b.toString(16).padStart(2, '0'))
    .join('');
};

Common errors and how to fix them

SymptomCauseFix
The command line digest differs from the one shown hereecho appends a newline by default, so one extra byte is hashed.Use echo -n or printf to drop the trailing newline.
A digest of non-ASCII text does not match the backendThe two sides are hashing different byte sequences because they use different character encodings, such as UTF-8 versus GBK.Agree on UTF-8 and encode to bytes that way before hashing on both sides.

Frequently asked questions

Is MD5 still safe to use?+

Only for non-security integrity checks, such as confirming that a file transferred completely. Both MD5 and SHA-1 have practical collision attacks, so neither belongs in password storage, digital signatures, or any decision that forms a security boundary. For passwords, use bcrypt, scrypt, or Argon2.

Can a hash be reversed back to the original text?+

Hashing is one-way and cannot be inverted. Short strings and common passwords are a different matter: an attacker can look them up in a rainbow table. That is why password hashes need a random per-user salt and a deliberately slow algorithm designed for passwords.

Related tools

All tools