Пример #1
0
            /* See http://www.hyperelliptic.org/EFD/g1p/auto-twisted-extended-1.html#doubling-dbl-2008-hwcd */
            static unsafe void dbl_p1p1(ge25519_p1p1 *r, ge25519_p2 *p)
            {
                fe25519 a, b, c, d;

                fe25519.fe25519_square(&a, &p->x);
                fe25519.fe25519_square(&b, &p->y);
                fe25519.fe25519_square(&c, &p->z);
                fe25519.fe25519_add(&c, &c, &c);
                fe25519.fe25519_neg(&d, &a);

                fe25519.fe25519_add(&r->x, &p->x, &p->y);
                fe25519.fe25519_square(&r->x, &r->x);
                fe25519.fe25519_sub(&r->x, &r->x, &a);
                fe25519.fe25519_sub(&r->x, &r->x, &b);
                fe25519.fe25519_add(&r->z, &d, &b);
                fe25519.fe25519_sub(&r->t, &r->z, &c);
                fe25519.fe25519_sub(&r->y, &d, &b);
            }
Пример #2
0
            static         Byte[] ge25519_neutral_t = new Byte[32];     // { 0 };

            static unsafe void p1p1_to_p2(ge25519_p2 *r, ge25519_p1p1 *p)
            {
                fe25519.fe25519_mul(&r->x, &p->x, &p->t);
                fe25519.fe25519_mul(&r->y, &p->y, &p->z);
                fe25519.fe25519_mul(&r->z, &p->z, &p->t);
            }