INNER CODE UNIT · TypeScript
share
privy-io/shamir-secret-sharing · src/index.ts:246
const share = new Uint8Array(secretLength + 1);
share[secretLength] = xCoordinates[i]!;
result.push(share);
}
const degree = threshold - 1;
for (let i = 0; i < secretLength; i++) {
const byte = secret[i]!;
const coefficients = newCoefficients(byte, degree);
for (let j = 0; j < shares; ++j) {
const x = xCoordinates[j]!;
const y = evaluate(coefficients, x, degree);
result[j]![i] = y;
}
}