Exemple #1
0
        public static void ge_p3_tobytes(byte[] s, int offset, ref GroupElementP3 h)
        {
            FieldElement recip;
            FieldElement x;
            FieldElement y;

            FieldOperations.fe_invert(out recip, ref h.Z);
            FieldOperations.fe_mul(out x, ref h.X, ref recip);
            FieldOperations.fe_mul(out y, ref h.Y, ref recip);
            FieldOperations.fe_tobytes(s, offset, ref y);
            s[offset + 31] ^= (byte)(FieldOperations.fe_isnegative(ref x) << 7);
        }
Exemple #2
0
        public static void scalarmult(
            byte[] q, int qoffset,
            byte[] n, int noffset,
            byte[] p, int poffset)
        {
            FieldElement p0;
            FieldElement q0;

            FieldOperations.fe_frombytes2(out p0, p, poffset);
            scalarmult(out q0, n, noffset, ref p0);
            FieldOperations.fe_tobytes(q, qoffset, ref q0);
        }