what-the-bank/sources/org/bouncycastle/math/ec/AbstractECMultiplier.java

22 lines
781 B
Java
Raw Permalink Normal View History

2024-07-27 18:17:47 +07:00
package org.bouncycastle.math.ec;
import java.math.BigInteger;
/* loaded from: classes6.dex */
public abstract class AbstractECMultiplier implements ECMultiplier {
protected abstract ECPoint multiplyPositive(ECPoint eCPoint, BigInteger bigInteger);
@Override // org.bouncycastle.math.ec.ECMultiplier
public ECPoint multiply(ECPoint eCPoint, BigInteger bigInteger) {
int signum = bigInteger.signum();
if (signum == 0 || eCPoint.isInfinity()) {
return eCPoint.getCurve().getInfinity();
}
ECPoint multiplyPositive = multiplyPositive(eCPoint, bigInteger.abs());
if (signum <= 0) {
multiplyPositive = multiplyPositive.negate();
}
return ECAlgorithms.validatePoint(multiplyPositive);
}
}