Reference

std/digest/sha512

std/digest/src/sha512.trb

Sha512, the SHA-512 of FIPS 180-4: the hash Ed25519 is defined over (RFC 8032 section 5.1, std/signature), and the same shape as Sha256 - fed at once or in pieces, answering a Digest of 64 bytes.

Its words are 64 bits wide, so they are UInt64s and every sum is UInt64.addedWrapping, the one arithmetic of the language that wraps instead of panicking; the shifts of an unsigned word are logical. No native, and the same bytes give the same digest in both back ends.

type Sha512

type Sha512

SHA-512, fed in pieces: Sha512.add takes the next bytes and Sha512.finished answers the digest of everything added so far without changing the hasher, so a hasher can be read, fed more, and read again.

Examples

print Sha512.of("abc".bytes().toList()).hex()

fn of

static fn of(bytes: Bytes): Digest

The digest of bytes in one call.

fn add

var fn add(bytes: Bytes)

Feeds the next bytes.

fn finished

fn finished(): Digest

The digest of everything added so far. The hasher itself is unchanged and may be fed more.