Jump consistent hash implementation in TypeScript
npm install @subspace/jump-consistent-hashUint8Arrays.
npm install @subspace/jump-consistent-hash
`NOTE: Requires Node.js v12+ or modern browser with BigInt support
How to use
TypeScript:
`typescript
import {randomBytes} from 'crypto';
import {jumpConsistentHash} from '@subspace/jump-consistent-hash';const bucket = jumpConsistentHash(randomBytes(8), 10);
`API
$3
Takes a key and number of buckets and returns bucket from range [0, numBuckets).*
key - 8 bytes key
* numBuckets` - number of buckets to which keys should be distributed