operator * method

ECPoint operator *(
  1. BigInt scalar
)

Scalar multiplication

Implementation

ECPoint operator *(BigInt scalar) {
  if (scalar == BigInt.zero || isInfinity) {
    return ECPoint.infinity;
  }

  ECPoint result = ECPoint.infinity;
  ECPoint addend = this;

  while (scalar > BigInt.zero) {
    if (scalar & BigInt.one == BigInt.one) {
      result = result + addend;
    }
    addend = addend + addend;
    scalar >>= 1;
  }

  return result;
}