Skip to main content

Module digest

Module digest 

Source
Expand description

Row digests (Phase 3 spec, section 5.1).

The ledger keeps a digest of each row instead of the row: SHA-256 of the canonical JSON of [value, ord, part], truncated to 16 bytes and written as 32 hex characters. Canonical JSON is compact and sorts object keys by their UTF-8 bytes; strings are escaped exactly as serde_json escapes them, so the canonical length of a value is also its compact encoded size. The digest never leaves the app.

Functionsยง

canonical_json
The canonical JSON of value.
canonical_len
The canonical (and compact) encoded size of value, in bytes.
row_digest
The ledger digest of a row: what changes when its value, order or group does.
write_canonical
Appends the canonical JSON of value to out.