Beispiel #1
0
/* final exponentiation - keep separate for multi-pairings and to avoid thrashing stack */
    public static FP12 fexp(FP12 m)
    {
        FP2  f = new FP2(new BIG(ROM.CURVE_Fra), new BIG(ROM.CURVE_Frb));
        BIG  x = new BIG(ROM.CURVE_Bnx);
        FP12 r = new FP12(m);
        FP12 x0, x1, x2, x3, x4, x5;

/* Easy part of final exp */
        FP12 lv = new FP12(r);

        lv.inverse();
        r.conj();

        r.mul(lv);
        lv.copy(r);
        r.frob(f);
        r.frob(f);
        r.mul(lv);
/* Hard part of final exp */
        lv.copy(r);
        lv.frob(f);
        x0 = new FP12(lv);
        x0.frob(f);
        lv.mul(r);
        x0.mul(lv);
        x0.frob(f);
        x1 = new FP12(r);
        x1.conj();
        x4 = r.pow(x);

        x3 = new FP12(x4);
        x3.frob(f);

        x2 = x4.pow(x);

        x5 = new FP12(x2);
        x5.conj();
        lv = x2.pow(x);

        x2.frob(f);
        r.copy(x2);
        r.conj();

        x4.mul(r);
        x2.frob(f);

        r.copy(lv);
        r.frob(f);
        lv.mul(r);

        lv.usqr();
        lv.mul(x4);
        lv.mul(x5);
        r.copy(x3);
        r.mul(x5);
        r.mul(lv);
        lv.mul(x2);
        r.usqr();
        r.mul(lv);
        r.usqr();
        lv.copy(r);
        lv.mul(x1);
        r.mul(x0);
        lv.usqr();
        r.mul(lv);
        r.reduce();
        return(r);
    }