fromBigInt method

void fromBigInt(
  1. BigInt n
)

fromBig sets v = n, and returns v. The bit length of n must not exceed 256.

Implementation

void fromBigInt(BigInt n) {
  if (n.bitLength > 32 * 8) {
    throw ArgumentError('edwards25519: invalid field element input size');
  }

  final uint8List = Uint8List(32);

  for (int i = 0; i < 32; i++) {
    uint8List[i] = (n >> (i * 8)).toUnsigned(8).toInt();
  }
  setBytes(uint8List);
}