Skip to content

Documentation / @etherfold/browser / simple_hash

Function: simple_hash()

simple_hash(obj): string

Defined in: core/dist/utils/hash.d.ts:22

A short, stable, order-insensitive digest of any JSON-ish value.

BigInt values are stringified with an n suffix on the way in, because JSON.stringify throws on them outright and a processor config holding a uint256 is ordinary.

Note the size: 32 bits, rendered base36. It is a change DETECTOR, not a cryptographic commitment, and it is compared against exactly one other value at a time.

The leading h is not decoration. A digest is persisted inside LastSync (as context.processor, context.config, context.source[].hash) and this repo's storage adapters revive BigInts from the "123n" string convention. A bare base36 digest of all digits ending in n (8918n) IS that shape, so it came back from storage as a BigInt rather than a string, and processorHash === context.processor then compared a string to a BigInt and discarded good state. No guard in the reviver can fix that one, because at that point the two are genuinely indistinguishable; only the digest can, by never having the shape.

Parameters

obj

any

Returns

string