RistrettoPoint.fromUniform constructor
Factory method to create a RistrettoPoint from a uniform byte representation.
This factory method creates a RistrettoPoint from a uniform byte representation, which is typically used for generating keys or secret values. It takes the input 'hash' as a byte array, extracts two parts ('rB' and 'lB') from it, maps them to Edwards curve points, adds them together, and returns the result as a RistrettoPoint.
Parameters:
- hash: A List
Returns:
- RistrettoPoint: A RistrettoPoint instance created from the uniform byte input.
Details:
- The method extracts two parts ('rB' and 'lB') from the input 'hash', maps them to Edwards curve points, and combines them to produce the resulting RistrettoPoint. This is often used in key generation processes.
Implementation
factory RistrettoPoint.fromUniform(List<int> hash) {
final rB =
BigintUtils.fromBytes(hash.sublist(0, 32), byteOrder: Endian.little) &
ristretto_tools.mask255;
final rPoint = mapToPoint(rB);
final lB =
BigintUtils.fromBytes(hash.sublist(32, 64), byteOrder: Endian.little) &
ristretto_tools.mask255;
final lPoint = mapToPoint(lB);
final sumPoint = rPoint + lPoint;
return RistrettoPoint.fromEdwardsPoint(sumPoint);
}