public static BigInteger[] getSi(int fieldSize, int curveA, BigInteger cofactor) { byte mu = getMu(curveA); int shifts = getShiftsForCofactor(cofactor); int index = fieldSize + 3 - curveA; BigInteger[] ui = getLucas(mu, index, false); if (mu == 1) { ui[0] = ui[0].negate(); ui[1] = ui[1].negate(); } BigInteger dividend0 = ECConstants.ONE.add(ui[1]).shiftRight(shifts); BigInteger dividend1 = ECConstants.ONE.add(ui[0]).shiftRight(shifts).negate(); return new BigInteger[] { dividend0, dividend1 }; }
BigInteger[] us = getLucas(mu, w, false); BigInteger twoToW = ECConstants.ZERO.setBit(w); BigInteger u1invert = us[1].modInverse(twoToW);
BigInteger[] us = getLucas(mu, w, false); BigInteger twoToW = ECConstants.ZERO.setBit(w); BigInteger u1invert = us[1].modInverse(twoToW);
BigInteger[] v = getLucas(mu, m, true); BigInteger vm = v[1];
BigInteger[] v = getLucas(mu, m, true); BigInteger vm = v[1];
/** * Computes the auxiliary values <code>s<sub>0</sub></code> and * <code>s<sub>1</sub></code> used for partial modular reduction. * @param curve The elliptic curve for which to compute * <code>s<sub>0</sub></code> and <code>s<sub>1</sub></code>. * @throws IllegalArgumentException if <code>curve</code> is not a * Koblitz curve (Anomalous Binary Curve, ABC). */ public static BigInteger[] getSi(ECCurve.AbstractF2m curve) { if (!curve.isKoblitz()) { throw new IllegalArgumentException("si is defined for Koblitz curves only"); } int m = curve.getFieldSize(); int a = curve.getA().toBigInteger().intValue(); byte mu = getMu(a); int shifts = getShiftsForCofactor(curve.getCofactor()); int index = m + 3 - a; BigInteger[] ui = getLucas(mu, index, false); if (mu == 1) { ui[0] = ui[0].negate(); ui[1] = ui[1].negate(); } BigInteger dividend0 = ECConstants.ONE.add(ui[1]).shiftRight(shifts); BigInteger dividend1 = ECConstants.ONE.add(ui[0]).shiftRight(shifts).negate(); return new BigInteger[] { dividend0, dividend1 }; }
int h = curve.getH().intValue(); int index = m + 3 - a; BigInteger[] ui = getLucas(mu, index, false);