コード例 #1
0
 public static uint[] FromBigInteger(BigInteger x)
 {
     uint[] z = Nat224.FromBigInteger(x);
     if (z[6] == P6 && Nat224.Gte(z, P))
     {
         Nat224.AddDWord(PInv, z, 0);
     }
     return(z);
 }
コード例 #2
0
        public static void Add(uint[] x, uint[] y, uint[] z)
        {
            uint c = Nat224.Add(x, y, z);

            if (c != 0 || (z[6] == P6 && Nat224.Gte(z, P)))
            {
                Nat224.AddDWord(PInv, z, 0);
            }
        }
コード例 #3
0
        public static void Twice(uint[] x, uint[] z)
        {
            uint c = Nat224.ShiftUpBit(x, 0, z);

            if (c != 0 || (z[6] == P6 && Nat224.Gte(z, P)))
            {
                Nat224.AddDWord(PInv, z, 0);
            }
        }
コード例 #4
0
        public static void AddOne(uint[] x, uint[] z)
        {
            Nat224.Copy(x, z);
            uint c = Nat224.Inc(z, 0);

            if (c != 0 || (z[6] == P6 && Nat224.Gte(z, P)))
            {
                Nat224.AddDWord(PInv, z, 0);
            }
        }
コード例 #5
0
        public static void Reduce32(uint x, uint[] z)
        {
            uint c = Nat224.Mul33WordAdd(PInv33, x, z, 0);

            Debug.Assert(c == 0 || c == 1);

            if (c != 0 || (z[6] == P6 && Nat224.Gte(z, P)))
            {
                Nat224.AddDWord(PInv, z, 0);
            }
        }
コード例 #6
0
        public static void Reduce(uint[] xx, uint[] z)
        {
            ulong c = Nat224.Mul33Add(PInv33, xx, 7, xx, 0, z, 0);

            c = Nat224.Mul33DWordAdd(PInv33, c, z, 0);

            Debug.Assert(c == 0 || c == 1);

            if (c != 0 || (z[6] == P6 && Nat224.Gte(z, P)))
            {
                Nat224.AddDWord(PInv, z, 0);
            }
        }