Skip to main content
Verticopolis engineGitHub

Module canonical

Module canonical 

Source
Expand description

Canonical JSON and the digest the conformance suite compares: object keys sorted, numbers and strings written one way, so two equal values always give the same text and the same hash on any platform.

Functions§

canonical_json
The canonical text of a value: keys in UTF-16 code unit order, numbers and strings as JavaScript’s JSON.stringify writes them.
digest
The first 16 hex digits of the SHA-256 of the value’s canonical JSON. Two games with equal state views have equal digests.