SHA-512 Hash Generator
Generate SHA-512 hashes for maximum security applications. SHA-512 produces a 512-bit (128 character hexadecimal) hash, offering the highest security level in the SHA-2 family.
Understanding SHA-512
| Property | Value |
|---|---|
| Output length | 512 bits (64 bytes) |
| Hex representation | 128 characters |
| Security | Very secure |
| Speed | Slower than SHA-256 |
| Use case | High-security applications |
SHA-512 Implementation
``javascript
// Using Web Crypto API
async function sha512(text) {
const encoder = new TextEncoder();
const data = encoder.encode(text);
const hashBuffer = await crypto.subtle.digest('SHA-512', data);
const hashArray = Array.from(new Uint8Array(hashBuffer));
return hashArray.map(b => b.toString(16).padStart(2, '0')).join('');
}
// Node.js
const crypto = require('crypto');
function sha512Node(text) {
return crypto.createHash('sha512').update(text).digest('hex');
}
// Example
await sha512('hello');
// "9b71d224bd62f3785d96d46ad3ea3d73319bfbc2890caadae2dff72519673ca72323c3d99ba5c11d7c7acc6e14b8c5da0c4663475c2e5c3adef46f73bcdec043"
`
SHA-512 vs SHA-256
| Aspect | SHA-256 | SHA-512 |
|---|---|---|
| Output size | 256 bits | 512 bits |
| Hex length | 64 chars | 128 chars |
| Security margin | High | Very high |
| Speed (64-bit CPU) | Slower | Faster |
| Speed (32-bit CPU) | Faster | Slower |
| Use case | General purpose | Maximum security |
When to Use SHA-512
| Scenario | Recommended |
|---|---|
| General integrity | SHA-256 |
| Certificates/TLS | SHA-256 |
| Password derivation | SHA-512 (in PBKDF2) |
| Long-term archives | SHA-512 |
| Blockchain | SHA-256 |
| Maximum security | SHA-512 |
SHA-512 Variants
| Variant | Output | Use Case |
|---|---|---|
| SHA-512 | 512 bits | Full output |
| SHA-512/256 | 256 bits | SHA-256 alternative |
| SHA-512/224 | 224 bits | Truncated output |
SHA-512/256 provides SHA-256-sized output with SHA-512's internal security.The Avalanche Effect
A one-character change produces a completely different digest — not a similar one. That
property is what makes a hash useful as a fingerprint:
| Input | MD5 | CRC32 |
|---|---|---|
hello | 5d41402abc4b2a76b9719d911017c592 | 3610a686 |
hello. | d94c10e437d18531e122ed0b45badd2a | 0a39d4f1 |
Hello | 8b1a9953c4611296a827abf8c47804d7 | f7d18982 |
hello and Hello differ by one bit of one byte, and share no part of their output.
RIPEMD-160 of hello is 108f07b8382412612c048d07d13f814118445acd, and of Hello is
d44426aca8ae0a69cdbc4021c64fa5ad68ca32fe` — same story.Digest Length and Collision Resistance
| Algorithm | Output | Birthday bound | Status |
|---|---|---|---|
| CRC32 | 32 bits | ~77,000 values | Checksum only |
| MD5 | 128 bits | 2⁶⁴ in theory | Broken — collisions in seconds |
| SHA-1 | 160 bits | 2⁸⁰ in theory | Broken — SHAttered, 2017 |
| RIPEMD-160 | 160 bits | 2⁸⁰ | No practical attack |
| SHA-256 | 256 bits | 2¹²⁸ | Current standard |
| SHA-512 | 512 bits | 2²⁵⁶ | Standard, faster on 64-bit |
Never Hash a Password With These
A general-purpose hash is designed to be fast, which is exactly wrong for passwords: speed helps the attacker. Use a deliberately slow KDF — bcrypt, scrypt or Argon2id — with a per-password salt. A GPU tries billions of SHA-256 guesses a second and a few thousand bcrypt guesses a second, and that gap is the entire defence.