SHA384 Generator Hash generators
Girdi
SHA-384 Hash
Settings
Developer Guide
What is SHA-384?
SHA-384 is a cryptographic hash function that produces a 384-bit (48-byte) hash value. It's part of the SHA-2 family, offering a higher security level than SHA-256 while being more efficient than SHA-512 on some platforms.
How SHA-384 Works
SHA-384 is a truncated version of SHA-512, using the same algorithm but different initial values and output length:
- Initialization: Uses different initial hash values than SHA-512
- Processing: Identical to SHA-512 with 80 rounds of operations
- Output Truncation: Final 512-bit state is truncated to 384 bits
- 64-bit Operations: Optimized for 64-bit processors
Security Considerations
SHA-384 Security Level:
- Classical Security: 192-bit security level
- Quantum Security: 192-bit against collision attacks
- Preimage Resistance: 384 bits
- Collision Resistance: 192 bits
Why Choose SHA-384?
- Higher security than SHA-256 (192-bit vs 128-bit)
- More efficient than SHA-512 when you don't need 512-bit output
- Better quantum resistance than SHA-256
- Widely supported in cryptographic libraries
Common Use Cases
Digital Certificates
Used in high-security TLS/SSL certificates requiring more than 128-bit security
Document Signing
Digital signatures for legal documents and contracts requiring long-term security
Government Systems
Meets requirements for classified and sensitive government data protection
Data Integrity
Ensuring integrity of critical databases and archival systems
JavaScript (Node.js)
const crypto = require('crypto');
// Generate SHA-384 hash
const text = 'Hello World';
const hash = crypto.createHash('sha384').update(text).digest('hex');
console.log(hash);
// 99514329186b2f6ae4a1329e7ee6c610a729636335174ac6b740f9028396fcc803d0e93863a7c3d90f86beee782f4f3f
// Hash a file
const fs = require('fs');
const fileBuffer = fs.readFileSync('file.txt');
const fileHash = crypto.createHash('sha384').update(fileBuffer).digest('hex');
// Streaming for large files
const stream = fs.createReadStream('large-file.bin');
const hash = crypto.createHash('sha384');
stream.on('data', data => hash.update(data));
stream.on('end', () => console.log(hash.digest('hex')));
Python
import hashlib
# Generate SHA-384 hash
text = "Hello World"
hash_object = hashlib.sha384(text.encode())
hex_dig = hash_object.hexdigest()
print(hex_dig)
# 99514329186b2f6ae4a1329e7ee6c610a729636335174ac6b740f9028396fcc803d0e93863a7c3d90f86beee782f4f3f
# Hash a file
def hash_file(filename):
sha384 = hashlib.sha384()
with open(filename, 'rb') as f:
while chunk := f.read(8192):
sha384.update(chunk)
return sha384.hexdigest()
file_hash = hash_file('document.pdf')
print(f"SHA-384: {file_hash}")
# HMAC-SHA384
import hmac
key = b'secret_key'
message = b'Hello World'
hmac_hash = hmac.new(key, message, hashlib.sha384).hexdigest()
PHP
// Generate SHA-384 hash
$text = "Hello World";
$hash = hash('sha384', $text);
echo $hash;
// 99514329186b2f6ae4a1329e7ee6c610a729636335174ac6b740f9028396fcc803d0e93863a7c3d90f86beee782f4f3f
// Hash with raw output (binary)
$binaryHash = hash('sha384', $text, true);
$hexHash = bin2hex($binaryHash);
// Hash a file
$fileHash = hash_file('sha384', 'document.pdf');
echo "SHA-384: " . $fileHash;
// HMAC-SHA384
$key = 'secret_key';
$hmac = hash_hmac('sha384', $text, $key);
// Verify hash
$expectedHash = '99514329186b...';
if (hash_equals($expectedHash, $hash)) {
echo "Hash verified!";
}
Command Line
# Linux/Mac
echo -n "Hello World" | sha384sum
# 99514329186b2f6ae4a1329e7ee6c610a729636335174ac6b740f9028396fcc803d0e93863a7c3d90f86beee782f4f3f -
# Hash a file
sha384sum document.pdf
# Multiple files
sha384sum *.txt > checksums.sha384
# Verify checksums
sha384sum -c checksums.sha384
# macOS
echo -n "Hello World" | shasum -a 384
# Windows (PowerShell)
Get-FileHash -Algorithm SHA384 file.txt
# OpenSSL
echo -n "Hello World" | openssl dgst -sha384
SHA-384 Reference
Algorithm Details
- Output: 384 bits (48 bytes)
- Hex string: 96 characters
- Block size: 1024 bits
- Word size: 64 bits
- Rounds: 80
- Part of SHA-2 family
Security Features
- ✓ Collision resistant
- ✓ Pre-image resistant
- ✓ Second pre-image resistant
- ✓ NIST approved
- ✓ FIPS 180-4 compliant
- ✓ Suitable for digital signatures
Common Uses
- Digital certificates
- TLS/SSL connections
- Code signing
- Blockchain applications
- Password hashing (with salt)
- File integrity verification
SHA-2 Family Comparison
| Algorithm | Output Size | Security Level | Performance |
|---|---|---|---|
| SHA-224 | 224 bits (56 hex) | 112-bit | Fast |
| SHA-256 | 256 bits (64 hex) | 128-bit | Fast |
| SHA-384 | 384 bits (96 hex) | 192-bit | Moderate |
| SHA-512 | 512 bits (128 hex) | 256-bit | Moderate |
| SHA-512/224 | 224 bits (56 hex) | 112-bit | Moderate |
| SHA-512/256 | 256 bits (64 hex) | 128-bit | Moderate |
SHA-384 Hash Examples
| Input | SHA-384 Hash (truncated for display) |
|---|---|
| "" (empty) | 38b060a751ac96384cd9327eb1b1e36a21fdb71114be0743... |
| "Hello World" | 99514329186b2f6ae4a1329e7ee6c610a729636335174ac6... |
| "abc" | cb00753f45a35e8bb5a03d699ac65007272c32ab0eded163... |
Performance Characteristics
SHA-384 Performance:
- 64-bit Systems: Similar performance to SHA-512
- 32-bit Systems: Slower than SHA-256 due to 64-bit operations
- Hardware Acceleration: Supported by modern CPUs (Intel SHA extensions)
- Typical Speed: 200-400 MB/s on modern CPUs
SHA-384 vs Other Hash Functions
When to Use SHA-384:
- Over SHA-256: When you need >128-bit security level
- Over SHA-512: When 384-bit output is sufficient and you want to save bandwidth
- Over SHA3-384: When you need compatibility with existing SHA-2 infrastructure
Security Comparison:
| Algorithm | Classical Security | Quantum Security | Output Size |
|---|---|---|---|
| SHA-256 | 128-bit | 128-bit | 256 bits |
| SHA-384 | 192-bit | 192-bit | 384 bits |
| SHA-512 | 256-bit | 256-bit | 512 bits |
Frequently Asked Questions
Q: Why use SHA-384 instead of SHA-256?
A: SHA-384 provides a higher security level (192-bit vs 128-bit) which is important for long-term security, quantum resistance, and compliance with certain security standards.
Q: Is SHA-384 slower than SHA-256?
A: On 64-bit systems, SHA-384 can be as fast or faster than SHA-256. On 32-bit systems, it's slower due to 64-bit arithmetic operations.
Q: Can SHA-384 be used for password hashing?
A: Like all fast hash functions, SHA-384 alone is not suitable for password hashing. Use it with PBKDF2, or preferably use bcrypt, scrypt, or Argon2.
Q: What's the difference between SHA-384 and SHA-512/384?
A: SHA-384 uses different initial values than SHA-512/384. Both produce 384-bit output, but SHA-512/384 has different security properties for length extension attacks.
Implementation Best Practices
DO:
- Use SHA-384 for applications requiring >128-bit security
- Implement proper HMAC-SHA384 for message authentication
- Use certified cryptographic libraries
- Consider SHA-384 for long-term archival signatures
DON'T:
- Use SHA-384 directly for password storage
- Implement your own SHA-384 algorithm
- Assume SHA-384 provides encryption (it's one-way only)
- Use on 32-bit systems if performance is critical