← index

[Crypto]Digestabstract

inherits Object

One-shot cryptographic digests (and MD5, kept with the hashes despite being broken for security use). Each method hashes a String's UTF-8 bytes or a Bytes value and answers the raw digest as Bytes — toHex for the usual text form, Base64.encode: for wire formats.

([Crypto]Digest.sha256:'abc').toHex.starts?:'ba7816bf'     "* -> true

Class methods

blake3:

The BLAKE3 digest (32 bytes) — the modern fast one.

([Crypto]Digest.blake3:'abc').count     "* -> 32

native

md5:

The MD5 digest (16 bytes). Not cryptography anymore — checksums and legacy interop only.

([Crypto]Digest.md5:'abc').count     "* -> 16

native

sha1:

The SHA-1 digest (20 bytes). Broken for collision resistance — for legacy interop (git object ids, old protocols), not for new designs.

([Crypto]Digest.sha1:'abc').count     "* -> 20

native

sha256:

The SHA-256 digest (32 bytes).

([Crypto]Digest.sha256:'abc').count     "* -> 32

native

sha512:

The SHA-512 digest (64 bytes).

([Crypto]Digest.sha512:'abc').count     "* -> 64

native