INNER CODE UNIT · TypeScript

sample

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

    const sample = share[shareLength - 1]!;

    // The last byte of each share should be a unique value between 1-255 inclusive.
    if (samples.has(sample)) {
      throw new Error('shares must contain unique values but a duplicate was found');
    }

    samples.add(sample);
    xSamples[i] = sample;
  }

  // Reconstruct each byte
  for (let i = 0; i < secretLength; i++) {
    // Set the y value for each sample
    for (let j = 0; j < sharesLength; ++j) {
      ySamples[j] = shares[j]![i]!;
    }

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…