Random SHA2 Hashes Generator
Generate real random SHA-256, SHA-384, and SHA-512 hashes using the Web Crypto API. Copy or download batches of cryptographic hashes instantly.
About
SHA-2 (Secure Hash Algorithm 2) is a family of cryptographic hash functions published by NIST in 2001 as FIPS 180-4. The family includes SHA-256, SHA-384, and SHA-512, producing digests of 256, 384, and 512 bits respectively. This tool generates genuine SHA-2 hashes by feeding cryptographically secure random bytes (32 bytes from crypto.getRandomValues) into the browser's native crypto.subtle.digest engine. The output is not a random hex string that merely looks like a hash. Each value is a real digest with the avalanche property and pre-image resistance expected of SHA-2.
Incorrect hash generation matters. Using predictable seeds or pseudo-random hex strings in test fixtures, database seeding, or integrity-check scaffolding introduces subtle bugs that surface only in production. A mock hash will not collide-resist like a real one, and length mismatches between SHA-256 (64 hex chars) and SHA-512 (128 hex chars) break schema validations silently. This generator eliminates that risk by computing actual digests against random entropy.
Formulas
Each hash is produced by computing a genuine SHA-2 digest over 32 bytes of cryptographically secure random data.
where R = crypto.getRandomValues(32 bytes) and H is the resulting digest encoded as a hexadecimal string.
The hex encoding converts each byte b of the raw digest to its two-character hexadecimal representation:
where n = digest length in bytes: 32 for SHA-256, 48 for SHA-384, 64 for SHA-512. The output hex string length is 2n characters. Collision probability for two randomly generated hashes follows the birthday bound: approximately 2n/2 hashes needed before a 50% collision chance. For SHA-256, that is 2128 ≈ 3.4 × 1038 hashes.
Reference Data
| SHA-2 Variant | Digest Size (bits) | Hex Length (chars) | Block Size (bits) | Rounds | Word Size (bits) | Collision Resistance (bits) | Pre-image Resistance (bits) | NIST Standard |
|---|---|---|---|---|---|---|---|---|
| SHA-224 | 224 | 56 | 512 | 64 | 32 | 112 | 224 | FIPS 180-4 |
| SHA-256 | 256 | 64 | 512 | 64 | 32 | 128 | 256 | FIPS 180-4 |
| SHA-384 | 384 | 96 | 1024 | 80 | 64 | 192 | 384 | FIPS 180-4 |
| SHA-512 | 512 | 128 | 1024 | 80 | 64 | 256 | 512 | FIPS 180-4 |
| SHA-512/224 | 224 | 56 | 1024 | 80 | 64 | 112 | 224 | FIPS 180-4 |
| SHA-512/256 | 256 | 64 | 1024 | 80 | 64 | 128 | 256 | FIPS 180-4 |
| SHA-1 (deprecated) | 160 | 40 | 512 | 80 | 32 | 61 (broken) | 160 | FIPS 180-4 (legacy) |
| MD5 (broken) | 128 | 32 | 512 | 64 | 32 | 18 (broken) | 128 | RFC 1321 (obsolete) |
| SHA-3-256 | 256 | 64 | 1088 | 24 | 64 | 128 | 256 | FIPS 202 |
| BLAKE2b-256 | 256 | 64 | 1024 | 12 | 64 | 128 | 256 | RFC 7693 |
| BLAKE3 | 256 | 64 | 512 | 7 | 32 | 128 | 256 | N/A (2020) |
| Whirlpool | 512 | 128 | 512 | 10 | 8 | 256 | 512 | ISO/IEC 10118-3 |