Networking · class
Fingerprint
An FNV-1a pair, fed bytes and numbers, answering sixteen hex characters.
Explained in Networking and rollback.
class Fingerprintimport { Fingerprint } from '@driftengine/network';In depth
A class rather than a function over one buffer, because state worth fingerprinting is rarely one buffer: a consumer combines a world, a generator's position and whatever they keep beside both, and the order they feed it in is theirs to fix.
Methods
reset
reset(): thisStart again, so one instance serves a whole session without allocating.
byte
byte(value: number): this| Parameter | Type | Description |
|---|---|---|
value | number |
int32
int32(value: number): thisA 32-bit integer, low byte first.
| Parameter | Type | Description |
|---|---|---|
value | number |
float
float(value: number): thisA double, as its eight bytes. See the header for why not as text.
| Parameter | Type | Description |
|---|---|---|
value | number |
array
array(values: ArrayLike<number> & { BYTES_PER_ELEMENT?: number; }, count?: number): thisA typed array's bytes, up to count elements, or all of them.
| Parameter | Type | Description |
|---|---|---|
values | ArrayLike<number> & { BYTES_PER_ELEMENT?: number; } | |
count? | number |
digest
digest(): stringSixteen lowercase hex characters.