Hash Digest Calculator
Compute MD5, SHA-1, SHA-224, SHA-256, SHA-384, SHA-512, SHA-512/224, SHA3-224, and SM3 hash digests. Supports text input, file hashing, and HMAC keyed mode. All computation in-browser.
HMAC Keyed Mode
Supported Hash Algorithms
| Algorithm | Output Bits | Standard | Security | Best Use |
|---|---|---|---|---|
| MD5 | 128 | RFC 1321 | Broken | Checksums, non-security use only |
| SHA-1 | 160 | FIPS 180-4 | Deprecated | Legacy systems, Git object IDs |
| SHA-256 | 256 | FIPS 180-4 | Secure | Digital signatures, certificates, blockchain |
| SHA-384 | 384 | FIPS 180-4 | Secure | High-security, ECDSA P-384 pairing |
| SHA-512 | 512 | FIPS 180-4 | Secure | File integrity, large data, HMAC |
| SHA-224 | 224 | FIPS 180-4 | Secure | DSA signatures, digital certs |
| SHA-512/224 | 224 | FIPS 180-4 | Secure | High-security 224-bit from SHA-512 |
| SHA3-224 | 224 | FIPS 202 | Secure | Post-quantum ready, sponge construction |
| SM3 | 256 | GM/T 0004-2012 | Secure | Chinese national standard, GM/T compliance |
Related Tools
- Base64 Encoder/Decoder — Encode/decode Base64 with three variants
- Crypto Checksum Verifier — 3DES Retail MAC, AES-CMAC, CRC-16/32
- CRC Calculator — CRC-8/16/32/64 with 17 variants
- Luhn Algorithm Validator — Credit card & IMEI check digit
Hash Functions in Smart Cards
Hash functions are fundamental to smart card security. They produce fixed-length digests from arbitrary-length inputs, enabling data integrity verification, digital signatures, and key derivation. In EMV, SHA-1 is used for SDA/DDA data authentication. In GP SCP03, SHA-256 is used for key derivation. In SM2 signatures, SM3 is the mandatory hash function.
What Makes a Hash Function Cryptographic?
A cryptographic hash function must satisfy three properties: preimage resistance (given a hash h, it is infeasible to find any message m such that hash(m) = h), second preimage resistance (given a message m1, it is infeasible to find a different m2 with the same hash), and collision resistance (it is infeasible to find any two messages m1 and m2 with the same hash). These properties make hash functions suitable for digital signatures — signing a hash of a document is equivalent to signing the document itself, because any change to the document changes the hash.
The SHA Family: A Brief History
SHA (Secure Hash Algorithm) was first published by NIST in 1993. SHA-0, the original version, was withdrawn almost immediately due to an undisclosed flaw. SHA-1 (1995, FIPS 180-1) became the workhorse of internet security — it was used in TLS certificates, Git, PGP, and countless other systems. In 2005, Wang et al. demonstrated a collision attack on SHA-1 requiring only 2^69 operations, and by 2017 Google and CWI produced the first public SHA-1 collision (the SHAttered attack). In 2020, the SHA-1 chosen-prefix attack became practical, allowing attackers to forge PGP keys. SHA-2 (FIPS 180-4, 2001) was designed as a drop-in replacement, with SHA-256 and SHA-512 being the most common variants. SHA-3 (Keccak, FIPS 202, 2015) is structurally different — a sponge construction rather than a Merkle-Damgard structure — and is recommended for long-term security.
SM3: China's National Hash Standard
SM3 was published in 2010 by the State Cryptography Administration and standardized as GM/T 0004-2012. It produces a 256-bit digest using a Merkle-Damgard construction with 64 rounds. SM3 is part of the Chinese cryptographic suite alongside SM2 (elliptic curve) and SM4 (symmetric cipher). SM3 is mandatory for Chinese government IT systems, used in SM2 digital signatures (analogous to ECDSA with SHA-256), and is required for financial applications under PBOC standards. RFC 8998 defines SM3 for TLS 1.3 handshakes. SM3 has been analyzed extensively by the international cryptographic community and no practical attacks have been found, making it comparable in security to SHA-256.
HMAC: Keyed Hashing for Authentication
Plain hash functions cannot authenticate the sender — anyone can compute the same hash. HMAC (Hash-based Message Authentication Code, RFC 2104) solves this by combining a hash function with a secret key. HMAC-H = H((K ⊕ opad) || H((K ⊕ ipad) || message)), where K is the key, ipad is 0x36 repeated, and opad is 0x5c repeated. HMAC provides both integrity and authenticity: only someone with the key can produce a valid MAC. HMAC-SHA-256 is the default in JWT (HS256), AWS request signing, and TLS 1.2's PRF. HMAC's security depends on the hash function's collision resistance and the key length — use at least 128-bit keys.
Algorithm Selection Guide
MD5 (128-bit): Do not use for security-critical applications. Collision attacks are trivial — two PDF files with the same MD5 can be generated in seconds. SHA-1 (160-bit): Legacy EMV systems still use it, but new systems should migrate. The SHAttered attack proved collisions are practically achievable. SHA-256 (256-bit): Recommended for new smart card systems, used in GP SCP03 and TLS 1.3. No practical attacks exist. SHA-384/512: For high-assurance applications. SHA-384 is mathematically derived from SHA-512 but truncated, making it faster on 64-bit processors. SM3 (256-bit): Required for Chinese national cryptographic compliance, used with SM2 signatures. For keyed hashing (HMAC), use our HMAC Generator. For PBKDF2 key derivation, use PBKDF2 Calculator.
Hashes in Digital Signatures
In practice, you never sign raw data directly with RSA or ECDSA — you sign a hash. The signature algorithm includes the hash as a parameter: "SHA256withRSA", "SHA384withECDSA", "SM3withSM2". The signer computes hash(data), then applies the signature primitive to the hash. The verifier recomputes the hash and checks the signature against it. This decouples data size from signature computation time. For EMV, the card signs a SHA-256 hash of transaction data to generate the Application Cryptogram (AC). For X.509 certificates, the CA signs a SHA-256 hash of the DER-encoded tbsCertificate structure. Understanding which hash function your signature algorithm uses is critical for interoperability.