/** * Does the precomputation for WTNAF multiplication. * @param p The <code>ECPoint</code> for which to do the precomputation. * @param a The parameter <code>a</code> of the elliptic curve. * @return The precomputation array for <code>p</code>. */ public static F2mPoint[] GetPreComp(F2mPoint p, sbyte a) { F2mPoint[] pu; pu = new F2mPoint[16]; pu[1] = p; sbyte[][] alphaTnaf; if (a == 0) { alphaTnaf = Tnaf.Alpha0Tnaf; } else { // a == 1 alphaTnaf = Tnaf.Alpha1Tnaf; } int precompLen = alphaTnaf.Length; for (int i = 3; i < precompLen; i = i + 2) { pu[i] = Tnaf.MultiplyFromTnaf(p, alphaTnaf[i]); } return(pu); }
public static AbstractF2mPoint MultiplyTnaf(AbstractF2mPoint p, ZTauElement lambda) { AbstractF2mCurve abstractF2mCurve = (AbstractF2mCurve)p.Curve; sbyte mu = Tnaf.GetMu(abstractF2mCurve.A); sbyte[] u = Tnaf.TauAdicNaf(mu, lambda); return(Tnaf.MultiplyFromTnaf(p, u)); }
public static AbstractF2mPoint[] GetPreComp(AbstractF2mPoint p, sbyte a) { sbyte[][] array = (a == 0) ? Tnaf.Alpha0Tnaf : Tnaf.Alpha1Tnaf; AbstractF2mPoint[] array2 = new AbstractF2mPoint[(uint)(array.Length + 1) >> 1]; array2[0] = p; uint num = (uint)array.Length; for (uint num2 = 3u; num2 < num; num2 += 2u) { array2[(int)((UIntPtr)(num2 >> 1))] = Tnaf.MultiplyFromTnaf(p, array[(int)((UIntPtr)num2)]); } p.Curve.NormalizeAll(array2); return(array2); }
/** * Does the precomputation for WTNAF multiplication. * @param p The <code>ECPoint</code> for which to do the precomputation. * @param a The parameter <code>a</code> of the elliptic curve. * @return The precomputation array for <code>p</code>. */ public static AbstractF2mPoint[] GetPreComp(AbstractF2mPoint p, sbyte a) { sbyte[][] alphaTnaf = (a == 0) ? Tnaf.Alpha0Tnaf : Tnaf.Alpha1Tnaf; AbstractF2mPoint[] pu = new AbstractF2mPoint[(uint)(alphaTnaf.Length + 1) >> 1]; pu[0] = p; uint precompLen = (uint)alphaTnaf.Length; for (uint i = 3; i < precompLen; i += 2) { pu[i >> 1] = Tnaf.MultiplyFromTnaf(p, alphaTnaf[i]); } p.Curve.NormalizeAll(pu); return(pu); }