MCPcopy
hub / github.com/signalapp/Signal-Desktop / getBucketValue

Function getBucketValue

ts/RemoteConfig.dom.ts:464–475  ·  view source on GitHub ↗
(aci: AciString, hashSalt: string)

Source from the content-addressed store, hash-verified

462}
463
464export function getBucketValue(aci: AciString, hashSalt: string): number {
465 const hashInput = Bytes.concatenate([
466 Bytes.fromString(`${hashSalt}.`),
467 uuidToBytes(aci),
468 ]);
469 const hashResult = window.SignalContext.crypto.hash(
470 HashType.size256,
471 hashInput
472 );
473
474 return Number(Bytes.readBigUint64BE(hashResult.subarray(0, 8)) % 1_000_000n);
475}

Callers 2

Calls 5

uuidToBytesFunction · 0.90
concatenateMethod · 0.80
fromStringMethod · 0.80
hashMethod · 0.80
readBigUint64BEMethod · 0.80

Tested by

no test coverage detected