/** * '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; } }
/** * '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; } }
protected ECPoint multiplyPositive(ECPoint p, BigInteger k) { int[] naf = WNafUtil.generateCompactNaf(k); ECPoint R0 = p.getCurve().getInfinity(), R1 = p; int zeroes = 0; for (int i = 0; i < naf.length; ++i) { int ni = naf[i]; int digit = ni >> 16; zeroes += ni & 0xFFFF; R1 = R1.timesPow2(zeroes); R0 = R0.add(digit < 0 ? R1.negate() : R1); zeroes = 1; } return R0; } }
protected ECPoint multiplyPositive(ECPoint p, BigInteger k) { int[] naf = WNafUtil.generateCompactNaf(k); ECPoint R0 = p.getCurve().getInfinity(), R1 = p; int zeroes = 0; for (int i = 0; i < naf.length; ++i) { int ni = naf[i]; int digit = ni >> 16; zeroes += ni & 0xFFFF; R1 = R1.timesPow2(zeroes); R0 = R0.add(digit < 0 ? R1.negate() : R1); zeroes = 1; } return R0; } }
/** * 'Zeroless' Signed Digit Right-to-Left. */ protected ECPoint multiplyPositive(ECPoint p, BigInteger k) { ECPoint R0 = p.getCurve().getInfinity(), R1 = p; int n = k.bitLength(); int s = k.getLowestSetBit(); R1 = R1.timesPow2(s); int i = s; while (++i < n) { R0 = R0.add(k.testBit(i) ? R1 : R1.negate()); R1 = R1.twice(); } R0 = R0.add(R1); return R0; } }
/** * 'Zeroless' Signed Digit Right-to-Left. */ protected ECPoint multiplyPositive(ECPoint p, BigInteger k) { ECPoint R0 = p.getCurve().getInfinity(), R1 = p; int n = k.bitLength(); int s = k.getLowestSetBit(); R1 = R1.timesPow2(s); int i = s; while (++i < n) { R0 = R0.add(k.testBit(i) ? R1 : R1.negate()); R1 = R1.twice(); } R0 = R0.add(R1); return R0; } }
protected ECPoint multiplyPositive(ECPoint p, BigInteger k) { int[] naf = WNafUtil.generateCompactNaf(k); ECPoint addP = p.normalize(), subP = addP.negate(); ECPoint R = p.getCurve().getInfinity(); int i = naf.length; while (--i >= 0) { int ni = naf[i]; int digit = ni >> 16, zeroes = ni & 0xFFFF; R = R.twicePlus(digit < 0 ? subP : addP); R = R.timesPow2(zeroes); } return R; } }
protected ECPoint multiplyPositive(ECPoint p, BigInteger k) { int[] naf = WNafUtil.generateCompactNaf(k); ECPoint addP = p.normalize(), subP = addP.negate(); ECPoint R = p.getCurve().getInfinity(); int i = naf.length; while (--i >= 0) { int ni = naf[i]; int digit = ni >> 16, zeroes = ni & 0xFFFF; R = R.twicePlus(digit < 0 ? subP : addP); R = R.timesPow2(zeroes); } return R; } }
protected ECPoint multiplyPositive(ECPoint p, BigInteger k) { ECCurve curveOrig = p.getCurve(); ECCurve curveAdd = configureCurve(curveOrig, additionCoord); ECCurve curveDouble = configureCurve(curveOrig, doublingCoord); int[] naf = WNafUtil.generateCompactNaf(k); ECPoint Ra = curveAdd.getInfinity(); ECPoint Td = curveDouble.importPoint(p); int zeroes = 0; for (int i = 0; i < naf.length; ++i) { int ni = naf[i]; int digit = ni >> 16; zeroes += ni & 0xFFFF; Td = Td.timesPow2(zeroes); ECPoint Tj = curveAdd.importPoint(Td); if (digit < 0) { Tj = Tj.negate(); } Ra = Ra.add(Tj); zeroes = 1; } return curveOrig.importPoint(Ra); }
protected ECPoint multiplyPositive(ECPoint p, BigInteger k) { ECCurve curveOrig = p.getCurve(); ECCurve curveAdd = configureCurve(curveOrig, additionCoord); ECCurve curveDouble = configureCurve(curveOrig, doublingCoord); int[] naf = WNafUtil.generateCompactNaf(k); ECPoint Ra = curveAdd.getInfinity(); ECPoint Td = curveDouble.importPoint(p); int zeroes = 0; for (int i = 0; i < naf.length; ++i) { int ni = naf[i]; int digit = ni >> 16; zeroes += ni & 0xFFFF; Td = Td.timesPow2(zeroes); ECPoint Tj = curveAdd.importPoint(Td); if (digit < 0) { Tj = Tj.negate(); } Ra = Ra.add(Tj); zeroes = 1; } return curveOrig.importPoint(Ra); }
for (int i = 1; i < minWidth; ++i) pow2Table[i] = pow2Table[i - 1].timesPow2(d);
for (int i = 1; i < minWidth; ++i) pow2Table[i] = pow2Table[i - 1].timesPow2(d);