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 |