INNER CODE UNIT · TypeScript

sum

privy-io/shamir-secret-sharing · src/index.ts:95

  const sum = (logA + logB) % 255;
  const result = EXP_TABLE[sum]!;

  return a === 0 || b === 0 ? 0 : result;
}

// Takes N sample points and returns the value at a given x using a lagrange interpolation.
function interpolatePolynomial(xSamples: Uint8Array, ySamples: Uint8Array, x: number): number {
  if (xSamples.length !== ySamples.length) {
    throw new Error('sample length mistmatch');
  }

  const limit = xSamples.length;

  let basis = 0;
  let result = 0;

  for (let i = 0; i < limit; i++) {

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…