List<int> scalarMult(List<int> P, int e)

Returns result of scalar multiplication of point P by integer e.

scalarMult([1,2], 10); // [298...422, 480...666]

Source

List<int> scalarMult(List<int> P, int e) {
  if (e == 0) {
    return [0, 1];
  }
  var Q = scalarMult(P, e ~/ 2);
  Q = edwards(Q, Q);
  if (e & 1 > 0) {
    Q = edwards(Q, P);
  }
  ;
  return Q;
}