RistrettoPoint.fromUniform constructor

RistrettoPoint.fromUniform(
  1. List<int> hash
)

Factory method to create a RistrettoPoint from a uniform byte representation.

Parameters:

  • hash: The uniform byte value to be converted.

Implementation

factory RistrettoPoint.fromUniform(List<int> hash) {
  final mask255 = BigInt.parse(
    "7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
    radix: 16,
  );

  final rB =
      BigintUtils.fromBytes(hash.sublist(0, 32), byteOrder: Endian.little) &
      mask255;
  final rPoint = mapToPoint(rB);

  final lB =
      BigintUtils.fromBytes(hash.sublist(32, 64), byteOrder: Endian.little) &
      mask255;
  final lPoint = mapToPoint(lB);

  final sumPoint = rPoint + lPoint;
  return RistrettoPoint.fromEdwardsPoint(sumPoint);
}