Modern Web Cryptography & Collision Resistance
Deep dive into W3C Web Crypto Subtleties, PRNG security boundaries, and hashing guarantees.
1. SHA-256 vs SHA-512 Security Profiles
SHA-256 and SHA-512 belong to the SHA-2 family defined by NIST in FIPS PUB 180-4. While SHA-256 operates on 32-bit words with 64 rounds of compression, SHA-512 operates on 64-bit words across 80 rounds. On modern 64-bit CPU architectures, SHA-512 is frequently faster than SHA-256 when processing large byte arrays while providing superior margin against length-extension attacks.
2. CSPRNG vs Pseudo-Random Numbers
Standard pseudorandom generators like JavaScript's Math.random() rely on deterministic algorithms like xoshiro128+ that are cryptographically broken. Given small sequences of outputs, internal states can be reverse-engineered. The Web Crypto crypto.getRandomValues() API accesses hardware entropy sources (such as thermal CPU jitter and interrupt timings) to ensure unpredictability.