Skip to content

Function: fingerprint() ​

ts
function fingerprint(value): string;

Defined in: lockstep.ts:207

A fingerprint of anything JSON can hold: the first 32 hex digits of the SHA-256 of its JSON text. Two simulations that save to the same JSON have the same one, and nobody can make a different simulation that has it too, which is what makes it the right hash for snapshots. It is what LockstepClient uses when a simulation has save and no hash.

It reads the whole value each time: about a millisecond for 100 KB of JSON. For a very large simulation, report it less often (hashEvery).

Parameters ​

ParameterType
valueunknown

Returns ​

string

MIT licence. Tickflare is an independent project and is not affiliated with Cloudflare.