blob: 93de81c9fc2e34f25c5e72e4a784a2c07b2c53b6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
package org.spongycastle.math.ec;
import java.math.BigInteger;
public abstract class AbstractECMultiplier implements ECMultiplier
{
public ECPoint multiply(ECPoint p, BigInteger k)
{
int sign = k.signum();
if (sign == 0 || p.isInfinity())
{
return p.getCurve().getInfinity();
}
ECPoint positive = multiplyPositive(p, k.abs());
return sign > 0 ? positive : positive.negate();
}
protected abstract ECPoint multiplyPositive(ECPoint p, BigInteger k);
}
|