Exemple #1
0
        private static uint[] PowCore(uint power, ref BitsBuffer value)
        {
            // Executes the basic pow algorithm.
            int size = value.GetSize();

            BitsBuffer temp   = new BitsBuffer(size, 0);
            BitsBuffer result = new BitsBuffer(size, 1);

            PowCore(power, ref value, ref result, ref temp);

            return(result.GetBits());
        }
        private static uint[] PowCore(uint power, ref BitsBuffer value)
        {
            // Executes the basic pow algorithm.
            int size = value.GetSize();

            BitsBuffer temp = new BitsBuffer(size, 0);
            BitsBuffer result = new BitsBuffer(size, 1);

            PowCore(power, ref value, ref result, ref temp);

            return result.GetBits();
        }
Exemple #3
0
        private static uint[] PowCore(uint power, uint[] modulus,
                                      ref BitsBuffer value)
        {
            // Executes the big pow algorithm.
            int size = value.GetSize();

            BitsBuffer temp   = new BitsBuffer(size, 0);
            BitsBuffer result = new BitsBuffer(size, 1);

            if (modulus.Length < ReducerThreshold)
            {
                PowCore(power, modulus, ref value, ref result, ref temp);
            }
            else
            {
                FastReducer reducer = new FastReducer(modulus);
                PowCore(power, ref reducer, ref value, ref result, ref temp);
            }

            return(result.GetBits());
        }
        private static uint[] PowCore(uint power, uint[] modulus,
                                      ref BitsBuffer value)
        {
            // Executes the big pow algorithm.

            int size = value.GetSize();

            BitsBuffer temp = new BitsBuffer(size, 0);
            BitsBuffer result = new BitsBuffer(size, 1);

            if (modulus.Length < ReducerThreshold)
            {
                PowCore(power, modulus, ref value, ref result, ref temp);
            }
            else
            {
                FastReducer reducer = new FastReducer(modulus);
                PowCore(power, ref reducer, ref value, ref result, ref temp);
            }

            return result.GetBits();
        }