SHA-512 Hash Generator
Online SHA-512 tool — hash text or files, generate HMAC-SHA-512, and verify checksums.
Free online SHA-512 generator — paste or type any text to compute its SHA-512 hash instantly, drop a file to hash its full contents, or switch to HMAC-SHA-512 mode with a secret key. Uses the browser's native crypto.subtle API — no data is sent to a server. No signup required.
Mode
HMAC secret key
The key is combined with the message via HMAC (RFC 2104). Leave empty to compute plain SHA-512.
Output case
About SHA-512
- Output
- 512 bits
- Hex length
- 128 chars
- Family
- SHA-2
- Rounds
- 80
- Word size
- 64-bit
Verify hash
Drop a file here
or click to browse — any file type, any size
Click or drop another file to replace
What is SHA-512?
SHA-512 (Secure Hash Algorithm 512) is a cryptographic hash function that takes any input — a byte, a sentence, a gigabyte file — and produces a fixed 512-bit (128 hex character) fingerprint called a digest. It belongs to the SHA-2 family, designed by the U.S. National Security Agency (NSA) and standardized by NIST in 2001 as FIPS 180-2.
Three properties make SHA-512 useful in security:
- Deterministic: the same input always produces the same hash.
- One-way: there is no algorithm to reverse a SHA-512 hash back to the original input.
- Avalanche effect: changing even one bit of the input produces a completely different hash — approximately half of the 512 output bits flip.
SHA-512("Hello, World!") =
374d794a95cdcfd8b35993185fef9ba368f160d8daf432d08ba9f1ed1e5abe6cc
69291e0fa2fe0006a52570ef18c19def4e617c33ce52ef0a6e5fbe318cb0387
Change one character — even just the case of "h" — and the entire hash changes.
How SHA-512 works
SHA-512 is a Merkle–Damgård construction with a Davies-Meyer compression function. At a high level:
- Padding: The input message is padded so its length is ≡ 896 (mod 1024) bits — leaving room for a 128-bit length field appended at the end. The total is always a multiple of 1024 bits (the block size).
- Initial hash values: Eight 64-bit words are initialized with the first 64 bits of the fractional parts of the square roots of the first 8 primes.
- Compression: Each 1024-bit block goes through 80 rounds of bitwise operations (majority, choice, sigma rotations, XOR) mixing the block with 64-bit schedule words and 64-bit round constants. The eight working variables are updated each round.
- Output: After all blocks are processed, the eight 64-bit working variables are concatenated to form the 512-bit digest.
SHA-512 uses 64-bit arithmetic throughout, which is why it is faster than SHA-256 on 64-bit CPUs (which can execute 64-bit operations natively) — SHA-256 uses 32-bit words and therefore needs more operations to process the same amount of data on 64-bit hardware.
SHA-512 vs SHA-256 vs MD5
Choosing the right hash function depends on what you need to protect and what hardware you are running on.
| Algorithm | Output | Rounds | Speed (64-bit) | Status |
|---|---|---|---|---|
| MD5 | 128 bits / 32 chars | 64 | Very fast | Broken — collisions trivial |
| SHA-1 | 160 bits / 40 chars | 80 | Fast | Broken — deprecated in TLS/certs |
| SHA-256 | 256 bits / 64 chars | 64 | Moderate on 64-bit | Secure — widely used |
| SHA-512 | 512 bits / 128 chars | 80 | Fastest on 64-bit | Secure — strongest SHA-2 |
| SHA-3 (Keccak) | 224–512 bits | 24 | Slower in SW | Secure — different design |
Use SHA-512 when maximum collision resistance matters, when you are on 64-bit infrastructure, or when protocol requirements specify it (e.g. some TLS cipher suites, certain JWT implementations). Use SHA-256 for Bitcoin, most TLS certificates, and general-purpose checksums. Never use MD5 or SHA-1 for new security-sensitive work.
How to generate a SHA-512 hash in JavaScript, Python, and PHP
All mainstream languages provide SHA-512 natively. For browser JavaScript, crypto.subtle is the standard API — it returns a Promise and the code running on this page uses exactly this approach.
JavaScript — browser (Web Crypto API)
async function sha512(text) {
const data = new TextEncoder().encode(text);
const buf = await crypto.subtle.digest('SHA-512', data);
return Array.from(new Uint8Array(buf))
.map(b => b.toString(16).padStart(2, '0')).join('');
}
// HMAC-SHA-512
async function hmacSha512(message, secret) {
const enc = new TextEncoder();
const key = await crypto.subtle.importKey(
'raw', enc.encode(secret),
{ name: 'HMAC', hash: 'SHA-512' }, false, ['sign']
);
const sig = await crypto.subtle.sign('HMAC', key, enc.encode(message));
return Array.from(new Uint8Array(sig))
.map(b => b.toString(16).padStart(2, '0')).join('');
}
await sha512('Hello, World!');
// 374d794a95cdcfd8b35993185fef9ba368f160d8daf432d08ba9f1ed1e5abe6cc...
Node.js (crypto module)
const { createHash, createHmac } = require('crypto');
// SHA-512
const hash = createHash('sha512').update('Hello, World!').digest('hex');
// HMAC-SHA-512
const mac = createHmac('sha512', 'secret').update('Hello, World!').digest('hex');
Python
import hashlib, hmac
# SHA-512
digest = hashlib.sha512(b'Hello, World!').hexdigest()
# HMAC-SHA-512
mac = hmac.new(b'secret', b'Hello, World!', hashlib.sha512).hexdigest()
# Constant-time comparison (prevents timing attacks)
hmac.compare_digest(digest, expected_hash)
PHP
// SHA-512
$hash = hash('sha512', 'Hello, World!');
// HMAC-SHA-512
$mac = hash_hmac('sha512', 'Hello, World!', 'secret');
// Constant-time comparison
hash_equals($hash, $expected_hash);
Working with hex-encoded data? Our hex decoder converts hex strings back to readable text. For JWT inspection, see the JWT decoder.
Common uses of SHA-512
SHA-512 appears throughout modern security infrastructure:
- File integrity verification: Software distributors publish SHA-512 checksums alongside downloads. Users hash the downloaded file and compare it to the published checksum — a mismatch means the file was corrupted or tampered with.
- Digital signatures: RSA and ECDSA signatures are computed over a hash of the data, not the data itself. SHA-512 is used when the highest collision resistance is needed (e.g. code-signing certificates).
- HMAC-SHA-512: Widely used for API request signing, JWT HS512 token signing, and webhook payload verification. The HMAC construction also eliminates SHA-512's vulnerability to length-extension attacks.
- Key derivation: PBKDF2-HMAC-SHA512 stretches a password into a cryptographic key by running HMAC-SHA512 tens of thousands of times — common in full-disk encryption and password managers.
- Unix password hashes: Linux's SHA-512-crypt (the default
$6$scheme in/etc/shadow) uses SHA-512 with a per-user salt and 5,000+ iteration rounds — though Argon2 is now preferred for new systems.
Frequently asked questions
$6$ password hashes. It is also used in some TLS cipher suites and certificate fingerprinting for stronger collision resistance than SHA-256.
HS512), API request signatures, and webhook payload verification. Switch this tool to HMAC mode and enter a secret key to compute one.
hmac.compare_digest() in Python, crypto.timingSafeEqual() in Node.js, or hash_equals() in PHP — to prevent timing attacks. Use the Verify section in this tool's left panel to check a hash directly in your browser.