Skip to main content

fingerprint

Function fingerprint 

Source
pub fn fingerprint(rows: &[RowMap]) -> Fingerprint
Expand description

Compute a SHA-256 fingerprint of a table’s row content.

Algorithm:

  1. Each row is serialised to a canonical JSON string (keys sorted by BTreeMap — already guaranteed by RowMap).
  2. Rows are sorted lexicographically by their JSON representation so the fingerprint is stable regardless of the order rows are returned by the DB.
  3. All row strings are joined with \n and hashed with SHA-256.

An empty table produces a well-defined fingerprint (hash of empty string).