(aci: AciString, hashSalt: string)
| 462 | } |
| 463 | |
| 464 | export 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 | } |
no test coverage detected