org.bouncycastle.math.ec.ZSignedDigitL2RMultiplier Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of bcprov-jdk15on Show documentation
Show all versions of bcprov-jdk15on Show documentation
The Bouncy Castle Crypto package is a Java implementation of cryptographic algorithms. This jar contains JCE provider and lightweight API for the Bouncy Castle Cryptography APIs for JDK 1.5 and up.
package org.bouncycastle.math.ec;
import java.math.BigInteger;
public class ZSignedDigitL2RMultiplier extends AbstractECMultiplier
{
/**
* 'Zeroless' Signed Digit Left-to-Right.
*/
protected ECPoint multiplyPositive(ECPoint p, BigInteger k)
{
ECPoint addP = p.normalize(), subP = addP.negate();
ECPoint R0 = addP;
int n = k.bitLength();
int s = k.getLowestSetBit();
int i = n;
while (--i > s)
{
R0 = R0.twicePlus(k.testBit(i) ? addP : subP);
}
R0 = R0.timesPow2(s);
return R0;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy