Good to know
The algorithms
All four come from the Secure Hash Standard, FIPS 180-4, and run on your browser’s built-in Web Crypto engine.
| Algorithm | Bits | Hex characters | Use today |
|---|---|---|---|
| SHA-1 | 160 | 40 | Old checksums only |
| SHA-256 | 256 | 64 | The usual choice |
| SHA-384 | 384 | 96 | Some certificate and API systems |
| SHA-512 | 512 | 128 | Large-margin uses |
There is no MD5 here. Web Crypto leaves it out because MD5 (RFC 1321) has been broken for years, and SHA-1 is in the same position: practical collisions exist, so neither should be trusted for security.
Check it yourself
The standard test text abc gives this SHA-256 value:
ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad
Type abc and you should see exactly that. Add a line break after it and the result changes entirely, because the line break is part of the data. Text is hashed as UTF-8 bytes, so the same words typed on another system can differ if that system uses another encoding or line ending.
HMAC
An HMAC (RFC 2104) mixes a secret key into the hash:
HMAC(K, m) = H( (K ⊕ opad) ‖ H( (K ⊕ ipad) ‖ m ) )
H is the hash, K the key, m the message, and opad and ipad fixed padding bytes. Only someone with the key can produce the same value, which is how payment and webhook services sign their messages. The key is used as UTF-8 text, exactly as typed.
Not for storing passwords
SHA hashes are designed to be fast, which helps attackers try billions of guesses a second. NIST SP 800-63B asks services to store passwords with a salted, deliberately slow method such as Argon2id, scrypt, bcrypt or PBKDF2.
Limits
Files up to 200 MB are read whole into memory, so very large files may be slow on a phone. The comparison ignores spaces and letter case for hex values; Base64 is compared exactly, with or without its = padding.