INNER CODE UNIT · TypeScript

coefficients

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

  const coefficients = new Uint8Array(degree + 1);
  coefficients[0] = intercept;
  coefficients.set(getRandomBytes(degree), 1);
  return coefficients;
}

// Creates a set of values from [1, 256).
// Returns a psuedo-random shuffling of the set.
function newCoordinates(): Readonly<Uint8Array> {
  const coordinates = new Uint8Array(255);
  for (let i = 0; i < 255; i++) {
    coordinates[i] = i + 1;
  }

  // Pseudo-randomize the array of coordinates.
  //
  // This impl maps almost perfectly because both of the lists (coordinates and randomIndices)
  // have a length of 255 and byte values are between 0 and 255 inclusive. The only value that

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…