Hash functions

SHA-512-256

The NIST Merkle–Damgård hash family behind most of today's TLS, signatures and software

safe Safe API Specified in a FIPS standard

About SHA-512-256

SHA-512-256 is one of 6 SHA-2 variants in the NextSSL registry, a cryptographic hash function. It produces a 32-byte (256-bit) output. Its registry entry cites FIPS 180-4. It is also known as sha-512/256. NextSSL lists it in the safe tier and exposes it through the safe API.

Overview

SHA-2 is a family of hash functions designed by the NSA and published by NIST in FIPS 180. SHA-256 and SHA-512 are the most widely deployed cryptographic hashes in use, and the family remains unbroken after more than two decades of analysis.

SHA-2 follows the Merkle–Damgård construction. The message is padded with a single 1 bit, zeros and a length field, split into fixed-size blocks, and fed through a compression function built in Davies–Meyer style from a dedicated block cipher. SHA-256 works on 32-bit words with 64 rounds over 512-bit blocks; SHA-512 uses 64-bit words with 80 rounds over 1024-bit blocks. Each round combines additions, rotations and the Ch and Maj boolean functions.

NextSSL carries SHA-224 and SHA-256 from the 32-bit branch, and SHA-384, SHA-512, SHA-512/224 and SHA-512/256 from the 64-bit branch. The truncated variants use distinct initial values, so they are not simple prefixes of the full outputs. SHA-512/256 is often faster than SHA-256 on 64-bit processors while offering the same nominal collision resistance.

SHA-256 and SHA-512 were introduced in FIPS 180-2 in 2002, SHA-224 was added in 2004, and the SHA-512/t variants arrived with FIPS 180-4. RFC 6234 provides a reference implementation. The family is used throughout TLS, X.509, code signing, Git's SHA-256 object format and many blockchains. It is the default hash in most libraries and the one auditors expect to see.

History

2001–2012
  1. SHA-256, SHA-384 and SHA-512 proposed

  2. Published in FIPS 180-2

  3. SHA-224 added

  4. Specified in RFC 6234

  5. SHA-512/224 and SHA-512/256 added in FIPS 180-4

How it works

  1. Pad the message and append its bit length
  2. Split into 512-bit (SHA-256) or 1024-bit (SHA-512) blocks
  3. Expand each block into a message schedule of 64 or 80 words
  4. Run the compression rounds and add the result into the chaining state
  5. Output the final state, truncated for the shorter variants

Security notes

No practical collision or preimage attacks are known against full SHA-2. SHA-256 and SHA-512 are vulnerable to length-extension, so they must not be used as a MAC by simple prefixing a key; use HMAC instead. SHA-384 and SHA-512/256 are not length-extendable because their output is truncated.

Typical uses

Digital signatures and certificatesHMAC and HKDFFile and package integrityContent addressing

Sizes

FieldBytesMeaning
out32Output

Use it

from nextssl_demo import NextSSL

ns = NextSSL()              # safe API: safe and standard tiers
digest = ns.call("hash_with", "sha512-256", None, b"abc")[0]

Calls follow the NextSSL C ABI and its language bindings. Buffer sizes are validated against the sizes above.

Other SHA-2 variants

5

Frequently asked questions

What is SHA-512-256?

SHA-512-256 is a hash in the SHA-2 family. SHA-2 is a family of hash functions designed by the NSA and published by NIST in FIPS 180. It is also known as sha-512/256.

What are the SHA-512-256 sizes?

In NextSSL, SHA-512-256 uses: output 32 bytes.

Who designed SHA-512-256 and when?

SHA-512-256 belongs to the SHA-2 family, first published in 2001 by National Security Agency. Its origin: NIST FIPS 180-2 / FIPS 180-4.

Which standards define SHA-512-256?

SHA-512-256 is referenced by FIPS 180-4. It is specified in a FIPS standard.

Is SHA-512-256 safe to use?

SHA-512-256 is in the safe tier. Modern and recommended. The default choice for new designs. It can be called from the safe API.

What other SHA-2 variants are there?

NextSSL also registers sha224, sha256, sha384, sha512, sha512-224 in the SHA-2 family.