4 min read
SHA-256 vs SHA-512
Differences, performance and security considerations for common hash algorithms.
Digest size
SHA-256 produces a 256-bit digest; SHA-512 produces a 512-bit digest. Both are members of the SHA-2 family and are considered secure for general use.
Performance
On 64-bit CPUs SHA-512 is often faster than SHA-256 for large inputs, while SHA-256 is more common in protocols and hardware.
Which to choose
Follow the requirements of the protocol you are implementing. For new applications either is acceptable; truncation and poor key handling are far bigger risks than the choice of digest.
Try it yourself
Compute SHA-1, SHA-256, SHA-384 and SHA-512 hashes of any text locally. Runs locally in your browser.
Open Hash Generator