示例#1
0
/* test group membership */
/* with GT-Strong curve, now only check that m!=1, conj(m)*m==1, and m.m^{p^4}=m^{p^2} */
    public static bool GTmember(FP12 m)
    {
        if (m.isunity())
        {
            return(false);
        }
        FP12 r = new FP12(m);

        r.conj();
        r.mul(m);
        if (!r.isunity())
        {
            return(false);
        }

        FP2 f = new FP2(new BIG(ROM.CURVE_Fra), new BIG(ROM.CURVE_Frb));

        r.copy(m);
        r.frob(f);
        r.frob(f);
        FP12 w = new FP12(r);

        w.frob(f);
        w.frob(f);
        w.mul(m);
        if (!ROM.GT_STRONG)
        {
            if (!w.Equals(r))
            {
                return(false);
            }
            BIG x = new BIG(ROM.CURVE_Bnx);
            r.copy(m);
            w = r.pow(x);
            w = w.pow(x);
            r.copy(w);
            r.sqr();
            r.mul(w);
            r.sqr();
            w.copy(m);
            w.frob(f);
        }
        return(w.Equals(r));
    }