what-the-bank/sources/org/bouncycastle/math/ec/MontgomeryLadderMultiplier....

23 lines
846 B
Java

package org.bouncycastle.math.ec;
import java.math.BigInteger;
/* loaded from: classes6.dex */
public class MontgomeryLadderMultiplier extends AbstractECMultiplier {
@Override // org.bouncycastle.math.ec.AbstractECMultiplier
protected ECPoint multiplyPositive(ECPoint eCPoint, BigInteger bigInteger) {
ECPoint[] eCPointArr = {eCPoint.getCurve().getInfinity(), eCPoint};
int bitLength = bigInteger.bitLength();
while (true) {
bitLength--;
if (bitLength < 0) {
return eCPointArr[0];
}
boolean testBit = bigInteger.testBit(bitLength);
int i = 1 - (testBit ? 1 : 0);
eCPointArr[i] = eCPointArr[i].add(eCPointArr[testBit ? 1 : 0]);
eCPointArr[testBit ? 1 : 0] = eCPointArr[testBit ? 1 : 0].twice();
}
}
}