SHA-512/256 is a 256-bit cryptographic hash from the SHA-2 family. It is built on the SHA-512 engine but uses its own initialization vector and truncates the output to 256 bits. The result is a hash that is as compact as SHA-256, faster on 64-bit hardware, and immune to the length-extension attacks that affect the non-truncated variants.
How it works
The message is padded to a multiple of 1024 bits: a single 1 bit, then zeros,
then a 128-bit big-endian length. It is processed in 1024-bit blocks. Each block
expands into eighty 64-bit words and is fed through the SHA-512 compression
rounds, which mix the eight working variables using the Ch, Maj, and sigma
functions with 64-bit rotations:
empty string -> c672b8d1ef56ed28ab87c3622c5114069bdd3ad7b8f9737498d0c01ecef0967a
"abc" -> 53048e2681941ef99b2e29b76b4c7dabe4c2d0c634fc6d46e0e2f13107e7af23
The only differences from SHA-512 are the eight starting values of the hash state and the final step, where just the leftmost four 64-bit words (256 bits) are kept. This tool implements all of that in pure JavaScript using BigInt for the 64-bit modular arithmetic.
Tips and notes
Input is encoded as UTF-8, so multibyte characters hash to their byte sequence,
not their code points. The digest is always 64 hexadecimal characters. You can
verify the implementation by clearing the box: the empty string must hash to
c672b8d1...ef0967a, the official test vector. Everything runs locally, so
hashing secrets or tokens here never transmits them anywhere.