示例#1
0
    public void ExponentiateX(long pow, byte[] output)
    {
        uint[] x   = GcmUtilities.OneAsUints();
        int    num = 0;

        while (pow > 0)
        {
            if ((pow & 1) != 0)
            {
                EnsureAvailable(num);
                GcmUtilities.Multiply(x, (uint[])lookupPowX2[num]);
            }
            num++;
            pow >>= 1;
        }
        GcmUtilities.AsBytes(x, output);
    }
 public void ExponentiateX(long pow, byte[] output)
 {
     uint[] array = GcmUtilities.OneAsUints();
     if (pow > 0)
     {
         uint[] y = Arrays.Clone(x);
         do
         {
             if ((pow & 1) != 0)
             {
                 GcmUtilities.Multiply(array, y);
             }
             GcmUtilities.Multiply(y, y);
             pow >>= 1;
         }while (pow > 0);
     }
     GcmUtilities.AsBytes(array, output);
 }
示例#3
0
        public void ExponentiateX(long pow, byte[] output)
        {
            // Initial value is little-endian 1
            ulong[] y = GcmUtilities.OneAsUlongs();

            if (pow > 0)
            {
                ulong[] powX = Arrays.Clone(x);
                do
                {
                    if ((pow & 1L) != 0)
                    {
                        GcmUtilities.Multiply(y, powX);
                    }
                    GcmUtilities.Square(powX, powX);
                    pow >>= 1;
                }while (pow > 0);
            }

            GcmUtilities.AsBytes(y, output);
        }
示例#4
0
 public void MultiplyH(byte[] x)
 {
     uint[] x2 = GcmUtilities.AsUints(x);
     GcmUtilities.Multiply(x2, H);
     GcmUtilities.AsBytes(x2, x);
 }