Beispiel #1
0
        public void ExponentiateX(long pow, byte[] output)
        {
            byte[] y   = GcmUtilities.OneAsBytes();
            int    bit = 0;

            while (pow > 0)
            {
                if ((pow & 1L) != 0)
                {
                    EnsureAvailable(bit);
                    GcmUtilities.Multiply(y, (byte[])lookupPowX2[bit]);
                }
                ++bit;
                pow >>= 1;
            }

            Array.Copy(y, 0, output, 0, 16);
        }
        public void ExponentiateX(long pow, byte[] output)
        {
            // Initial value is little-endian 1
            byte[] y = GcmUtilities.OneAsBytes();

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

            Array.Copy(y, 0, output, 0, 16);
        }