Skip to content

std/crypto/digest

module crypto.digest

Cryptographic digests of text and of Data trees. An algorithm is named by a type, as a format is: "abc".digest(Sha256). Every algorithm is a cryptographic hash function; Md5 and Sha1 are broken for collision resistance and serve interoperability with digests other tools wrote.

  • Algorithm — A cryptographic hash function.
  • Md5 — A cryptographic hash function.
  • Sha1 — A cryptographic hash function.
  • Sha256 — A cryptographic hash function.
  • Sha512 — A cryptographic hash function.
  • Blake3 — A cryptographic hash function.
  • digest — The digest of self's UTF-8 octets under as, written as lowercase hexadecimal, two digits per octet: "abc".digest(Sha256) is "ba7816bf…15ad".
  • fingerprint — The SHA-256 digest of the canonical JSON text of a tree (RFC 8785): keys sorted by their UTF-16 code units, no whitespace, a number as its digits without trailing zeros, a time value as its ISO 8601 text.
  • canonical — The canonical JSON text of a tree (RFC 8785), the text fingerprint digests: fingerprint(x) == canonical(x).digest(Sha256).