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

24 lines
869 B
Java

package org.bouncycastle.math.ec;
import java.math.BigInteger;
/* loaded from: classes6.dex */
public class NafL2RMultiplier extends AbstractECMultiplier {
@Override // org.bouncycastle.math.ec.AbstractECMultiplier
protected ECPoint multiplyPositive(ECPoint eCPoint, BigInteger bigInteger) {
int[] generateCompactNaf = WNafUtil.generateCompactNaf(bigInteger);
ECPoint normalize = eCPoint.normalize();
ECPoint negate = normalize.negate();
ECPoint infinity = eCPoint.getCurve().getInfinity();
int length = generateCompactNaf.length;
while (true) {
length--;
if (length < 0) {
return infinity;
}
int i = generateCompactNaf[length];
infinity = infinity.twicePlus((i >> 16) < 0 ? negate : normalize).timesPow2(i & 65535);
}
}
}