Algorithms

SHA-512Half

The first 32 bytes of SHA-512. The XRP Ledger hash for transactions and ledger objects. Not SHA-512/256
IDsha512-half04 / 24cryptographic · 256-bit
Hash / Cryptographic

SHA-512Half

The first half of SHA-512, which is not SHA-512/256.

Digest
256-bit · 32 bytes
HMAC
no key mode
Security
128-bit collision resistance
Used by
XRP Ledger
1 option, 0 required

Sample

hex
309ecc489c12d6eb4cc40f50c902f2b4d0ed77ee511a7c7a9bcd3ca86d4cd86f
base64
MJ7MSJwS1utMxA9QyQLytNDtd+5RGnx6m808qG1M2G8=

Options

encodingstring
default hex
Output encoding: hex, base64, base64url, binary

Access

Createcreate("sha512-half")
CLIhashes sha512-half 'hello world'
Tryplayground with the sample above
Kinsha256, sha384, sha512, sha3-256 +11

The XRP Ledger's hash: run SHA-512, keep the first half. Transaction IDs, ledger object keys and signing hashes all use it.

ts
create("sha512-half").hash("abc").digest;
// "ddaf35a193617abacc417349ae20413112e6fa4e89a97ea20a9eeee64b55d39a"
create("sha512").hash("abc").digest.slice(0, 64);
// "ddaf35a193617abacc417349ae20413112e6fa4e89a97ea20a9eeee64b55d39a", the same bytes

The trap is SHA-512/256, the NIST variant with the same length and a similar name. It starts from different initial values, so for abc it gives 53048e26…, a completely different digest. Pick the one the ledger picked. No HMAC mode, since the ledger never keys it.