public void PolyInftyNormCoeffmodNET()
        {
            var     poly    = new BigPoly("1x^10 + 2x^9 + 5x^8 + Ax^7 + Bx^6 + 4x^5 + 1x^2 + 1");
            BigUInt value   = new BigUInt();
            BigUInt modulus = new BigUInt();

            modulus.Set(5);
            var inftynorm = Utilities.PolyInftyNormCoeffmod(poly, modulus);

            value.Set("2");
            Assert.AreEqual(value, inftynorm);

            poly.Set("AAx^10 + ABx^9 + CAx^8 + CFx^7 + FEx^6 + F7x^5 + 1x^2 + 2");
            modulus.Set("10");
            inftynorm = Utilities.PolyInftyNormCoeffmod(poly, modulus);
            value.Set("7");
            Assert.AreEqual(value, inftynorm);

            poly.Set("Ax^10 + ABx^9 + ABCx^8 + ABCDx^7 + ABCDEx^6 + ABCDEFx^5 + 1x^2 + 2");
            modulus.Set("4");
            inftynorm = Utilities.PolyInftyNormCoeffmod(poly, modulus);
            value.Set("2");
            Assert.AreEqual(value, inftynorm);

            poly.Set("1x^5 + 2x^4 + 3x^3 + 4x^2 + 5x^1 + 6");
            modulus.Set("4");
            inftynorm = Utilities.PolyInftyNormCoeffmod(poly, modulus);
            value.Set("2");
            Assert.AreEqual(value, inftynorm);
        }
Exemplo n.º 2
0
        public void TransformPlainToFromNTTNET()
        {
            var parms = new EncryptionParameters(MemoryPoolHandle.AcquireNew());

            parms.SetDecompositionBitCount(4);
            parms.SetNoiseStandardDeviation(3.19);
            parms.SetNoiseMaxDeviation(35.06);

            var coeffModulus = new BigUInt(48);

            coeffModulus.Set("FFFFFFFFC001");
            parms.SetCoeffModulus(coeffModulus);

            var plainModulus = new BigUInt(7);

            plainModulus.Set(1 << 6);
            parms.SetPlainModulus(plainModulus);

            var polyModulus = new BigPoly(65, 1);

            polyModulus[0].Set(1);
            polyModulus[64].Set(1);
            parms.SetPolyModulus(polyModulus);

            parms.Validate();

            var evaluator = new Evaluator(parms, MemoryPoolHandle.AcquireNew());
            var plain     = new BigPoly(65, 1);

            plain.Set("0");
            evaluator.TransformToNTT(plain);
            Assert.IsTrue(plain.ToString() == "0");
            evaluator.TransformFromNTT(plain);
            Assert.IsTrue(plain.ToString() == "0");

            plain.Set("1");
            evaluator.TransformToNTT(plain);
            for (int i = 0; i < 64; i++)
            {
                Assert.IsTrue(plain[i].ToString() == "1");
            }
            Assert.IsTrue(plain[64].ToString() == "0");
            evaluator.TransformFromNTT(plain);
            Assert.IsTrue(plain.ToString() == "1");

            plain.Set("2");
            evaluator.TransformToNTT(plain);
            for (int i = 0; i < 64; i++)
            {
                Assert.IsTrue(plain[i].ToString() == "2");
            }
            Assert.IsTrue(plain[64].ToString() == "0");
            evaluator.TransformFromNTT(plain);
            Assert.IsTrue(plain.ToString() == "2");

            plain.Set("Fx^10 + Ex^9 + Dx^8 + Cx^7 + Bx^6 + Ax^5 + 1x^4 + 2x^3 + 3x^2 + 4x^1 + 5");
            evaluator.TransformToNTT(plain);
            evaluator.TransformFromNTT(plain);
            Assert.IsTrue(plain.ToString() == "Fx^10 + Ex^9 + Dx^8 + Cx^7 + Bx^6 + Ax^5 + 1x^4 + 2x^3 + 3x^2 + 4x^1 + 5");
        }
Exemplo n.º 3
0
        public void TransformEncryptedToFromNTTNET()
        {
            var parms = new EncryptionParameters(MemoryPoolHandle.AcquireNew());

            parms.SetDecompositionBitCount(4);
            parms.SetNoiseStandardDeviation(3.19);
            parms.SetNoiseMaxDeviation(35.06);

            var coeffModulus = new BigUInt(48);

            coeffModulus.Set("FFFFFFFFC001");
            parms.SetCoeffModulus(coeffModulus);

            var plainModulus = new BigUInt(7);

            plainModulus.Set(1 << 6);
            parms.SetPlainModulus(plainModulus);

            var polyModulus = new BigPoly(65, 1);

            polyModulus[0].Set(1);
            polyModulus[64].Set(1);
            parms.SetPolyModulus(polyModulus);

            parms.Validate();

            var keygen = new KeyGenerator(parms, MemoryPoolHandle.AcquireNew());

            keygen.Generate();

            var encryptor = new Encryptor(parms, keygen.PublicKey, MemoryPoolHandle.AcquireNew());
            var evaluator = new Evaluator(parms, MemoryPoolHandle.AcquireNew());
            var decryptor = new Decryptor(parms, keygen.SecretKey, MemoryPoolHandle.AcquireNew());

            var plain  = new BigPoly(65, 1);
            var cipher = new BigPolyArray(2, 65, 1);

            plain.Set("0");
            encryptor.Encrypt(plain, cipher);
            evaluator.TransformToNTT(cipher);
            evaluator.TransformFromNTT(cipher);
            decryptor.Decrypt(cipher, plain);
            Assert.IsTrue(plain.ToString() == "0");

            plain.Set("1");
            encryptor.Encrypt(plain, cipher);
            evaluator.TransformToNTT(cipher);
            evaluator.TransformFromNTT(cipher);
            decryptor.Decrypt(cipher, plain);
            Assert.IsTrue(plain.ToString() == "1");

            plain.Set("Fx^10 + Ex^9 + Dx^8 + Cx^7 + Bx^6 + Ax^5 + 1x^4 + 2x^3 + 3x^2 + 4x^1 + 5");
            encryptor.Encrypt(plain, cipher);
            evaluator.TransformToNTT(cipher);
            evaluator.TransformFromNTT(cipher);
            decryptor.Decrypt(cipher, plain);
            Assert.IsTrue(plain.ToString() == "Fx^10 + Ex^9 + Dx^8 + Cx^7 + Bx^6 + Ax^5 + 1x^4 + 2x^3 + 3x^2 + 4x^1 + 5");
        }
Exemplo n.º 4
0
        public void BigPolyFromStringNET()
        {
            var poly = new BigPoly("9x^2 + 2");

            Assert.AreEqual("9x^2 + 2", poly.ToString());
            Assert.AreEqual(3, poly.CoeffCount);
            Assert.AreEqual(4, poly.CoeffBitCount);

            poly.Resize(0, 0);
            poly.Set("0");
            Assert.AreEqual("0", poly.ToString());
            Assert.AreEqual(0, poly.CoeffCount);
            Assert.AreEqual(0, poly.CoeffBitCount);

            poly.Set("1");
            Assert.AreEqual("1", poly.ToString());
            Assert.AreEqual(1, poly.CoeffCount);
            Assert.AreEqual(1, poly.CoeffBitCount);

            poly.Set("123");
            Assert.AreEqual("123", poly.ToString());
            Assert.AreEqual(1, poly.CoeffCount);
            Assert.AreEqual(9, poly.CoeffBitCount);

            poly.Set("23x^3");
            Assert.AreEqual("23x^3", poly.ToString());
            Assert.AreEqual(4, poly.CoeffCount);
            Assert.AreEqual(9, poly.CoeffBitCount);

            poly.Resize(0, 0);
            poly.Set("23x^3");
            Assert.AreEqual("23x^3", poly.ToString());
            Assert.AreEqual(4, poly.CoeffCount);
            Assert.AreEqual(6, poly.CoeffBitCount);

            poly.Set("3x^2 + 2x^1");
            Assert.AreEqual("3x^2 + 2x^1", poly.ToString());
            Assert.AreEqual(4, poly.CoeffCount);
            Assert.AreEqual(6, poly.CoeffBitCount);

            poly.Set("1x^2 + 2x^1 + 3");
            Assert.AreEqual("1x^2 + 2x^1 + 3", poly.ToString());
            Assert.AreEqual(4, poly.CoeffCount);
            Assert.AreEqual(6, poly.CoeffBitCount);

            poly.Set("4x^1");
            Assert.AreEqual("4x^1", poly.ToString());
            Assert.AreEqual(4, poly.CoeffCount);
            Assert.AreEqual(6, poly.CoeffBitCount);
        }
Exemplo n.º 5
0
        public void BigPolyEvalPolyPolyModCoeffModNET()
        {
            var modulus      = new BigUInt("5");
            var polymod      = new BigPoly("1x^3 + 3x^1 + 1");
            var poly_to_eval = new BigPoly("0");
            var poly         = new BigPoly("0");
            var result       = Utilities.PolyEvalPolyPolymodCoeffmod(poly_to_eval, poly, polymod, modulus);

            Assert.AreEqual("0", result.ToString());

            poly_to_eval.Set("1");
            poly.Set("0");
            result = Utilities.PolyEvalPolyPolymodCoeffmod(poly_to_eval, poly, polymod, modulus);
            Assert.AreEqual("1", result.ToString());

            poly_to_eval.Set("4");
            poly.Set("0");
            result = Utilities.PolyEvalPolyPolymodCoeffmod(poly_to_eval, poly, polymod, modulus);
            Assert.AreEqual("4", result.ToString());

            poly_to_eval.Set("4");
            poly.Set("1");
            result = Utilities.PolyEvalPolyPolymodCoeffmod(poly_to_eval, poly, polymod, modulus);
            Assert.AreEqual("4", result.ToString());

            poly_to_eval.Set("0");
            poly.Set("1");
            result = Utilities.PolyEvalPolyPolymodCoeffmod(poly_to_eval, poly, polymod, modulus);
            Assert.AreEqual("0", result.ToString());

            poly_to_eval.Set("1x^1 + 2");
            poly.Set("1");
            result = Utilities.PolyEvalPolyPolymodCoeffmod(poly_to_eval, poly, polymod, modulus);
            Assert.AreEqual("3", result.ToString());

            poly_to_eval.Set("1x^1 + 4");
            poly.Set("2x^1 + 1");
            result = Utilities.PolyEvalPolyPolymodCoeffmod(poly_to_eval, poly, polymod, modulus);
            Assert.AreEqual("2x^1", result.ToString());

            poly_to_eval.Set("1x^1 + 1");
            poly.Set("1x^2 + 2x^1 + 3");
            result = Utilities.PolyEvalPolyPolymodCoeffmod(poly_to_eval, poly, polymod, modulus);
            Assert.AreEqual("1x^2 + 2x^1 + 4", result.ToString());

            poly_to_eval.Set("1x^2 + 1");
            poly.Set("1x^2 + 2x^1 + 3");
            result = Utilities.PolyEvalPolyPolymodCoeffmod(poly_to_eval, poly, polymod, modulus);
            Assert.AreEqual("2x^2 + 4x^1 + 1", result.ToString());
        }
        public void PolyInftyNormNET()
        {
            var     poly      = new BigPoly("1x^10 + 2x^9 + 5x^8 + Ax^7 + Bx^6 + 4x^5 + 1x^2 + 1");
            BigUInt value     = new BigUInt();
            var     inftynorm = Utilities.PolyInftyNorm(poly);

            value.Set("B");
            Assert.AreEqual(value, inftynorm);

            poly.Set("AAx^10 + ABx^9 + CAx^8 + CFx^7 + FEx^6 + F7x^5 + 1x^2 + 2");
            inftynorm = Utilities.PolyInftyNorm(poly);
            value.Set("FE");
            Assert.AreEqual(value, inftynorm);

            poly.Set("Ax^10 + ABx^9 + ABCx^8 + ABCDx^7 + ABCDEx^6 + ABCDEFx^5 + 1x^2 + 2");
            inftynorm = Utilities.PolyInftyNorm(poly);
            value.Set("ABCDEF");
            Assert.AreEqual(value, inftynorm);

            poly.Set("1x^5 + 2x^4 + 3x^3 + 4x^2 + 5x^1 + 6");
            inftynorm = Utilities.PolyInftyNorm(poly);
            value.Set("6");
            Assert.AreEqual(value, inftynorm);
        }
Exemplo n.º 7
0
        public void ExponentiatePolyPolyPolyModCoeffModNET()
        {
            var poly     = new BigPoly("1x^2 + 2x^1 + 3");
            var modulus  = new BigUInt("5");
            var exponent = new BigUInt("1");
            var polymod  = new BigPoly("1x^3 + 3x^1 + 1");
            var result   = Utilities.ExponentiatePolyPolymodCoeffmod(poly, exponent, polymod, modulus);

            Assert.AreEqual("1x^2 + 2x^1 + 3", result.ToString());
            exponent.Set("2");
            result = Utilities.ExponentiatePolyPolymodCoeffmod(poly, exponent, polymod, modulus);
            Assert.AreEqual("2x^2 + 4x^1", result.ToString());

            poly.Set("1");
            exponent.Set("2");
            result = Utilities.ExponentiatePolyPolymodCoeffmod(poly, exponent, polymod, modulus);
            Assert.AreEqual("1", result.ToString());
            exponent.Set("F00F000F00");
            result = Utilities.ExponentiatePolyPolymodCoeffmod(poly, exponent, polymod, modulus);
            Assert.AreEqual("1", result.ToString());
        }
Exemplo n.º 8
0
        public void BigPoly3Coeff100BitsNET()
        {
            var poly = new BigPoly(3, 100);

            Assert.AreEqual(3, poly.CoeffCount);
            Assert.AreEqual(100, poly.CoeffBitCount);
            Assert.IsTrue(null != poly.Pointer);
            Assert.AreEqual(6, poly.UInt64Count);
            Assert.AreEqual(0, poly.GetSignificantCoeffCount());
            Assert.AreEqual("0", poly.ToString());
            Assert.IsTrue(poly.IsZero);
            Assert.AreEqual(0UL, poly.Pointer[0]);
            Assert.AreEqual(0UL, poly.Pointer[1]);
            Assert.AreEqual(0UL, poly.Pointer[2]);
            Assert.AreEqual(0UL, poly.Pointer[3]);
            Assert.AreEqual(0UL, poly.Pointer[4]);
            Assert.AreEqual(0UL, poly.Pointer[5]);

            poly[0].Set("1234");
            Assert.AreEqual("1234", poly[0].ToString());
            Assert.AreEqual(1, poly.GetSignificantCoeffCount());
            Assert.AreEqual("1234", poly.ToString());
            Assert.IsFalse(poly.IsZero);
            Assert.AreEqual(0x1234UL, poly.Pointer[0]);
            Assert.AreEqual(0UL, poly.Pointer[1]);
            Assert.AreEqual(0UL, poly.Pointer[2]);
            Assert.AreEqual(0UL, poly.Pointer[3]);
            Assert.AreEqual(0UL, poly.Pointer[4]);
            Assert.AreEqual(0UL, poly.Pointer[5]);

            poly[2].Set("3211234567812345678");
            Assert.AreEqual("3211234567812345678", poly[2].ToString());
            Assert.AreEqual(3, poly.GetSignificantCoeffCount());
            Assert.AreEqual("3211234567812345678x^2 + 1234", poly.ToString());
            Assert.IsFalse(poly.IsZero);
            Assert.AreEqual(0x1234UL, poly.Pointer[0]);
            Assert.AreEqual(0UL, poly.Pointer[1]);
            Assert.AreEqual(0UL, poly.Pointer[2]);
            Assert.AreEqual(0UL, poly.Pointer[3]);
            Assert.AreEqual(0x1234567812345678UL, poly.Pointer[4]);
            Assert.AreEqual(0x321UL, poly.Pointer[5]);

            poly.SetZero();
            Assert.IsTrue(poly.IsZero);
            Assert.AreEqual("0", poly.ToString());
            Assert.AreEqual(0UL, poly.Pointer[0]);
            Assert.AreEqual(0UL, poly.Pointer[1]);
            Assert.AreEqual(0UL, poly.Pointer[2]);
            Assert.AreEqual(0UL, poly.Pointer[3]);
            Assert.AreEqual(0UL, poly.Pointer[4]);
            Assert.AreEqual(0UL, poly.Pointer[5]);

            poly[0].Set("123");
            poly[1].Set("456");
            poly[2].Set("3211234567812345678");
            Assert.AreEqual("3211234567812345678x^2 + 456x^1 + 123", poly.ToString());
            Assert.AreEqual(3, poly.GetSignificantCoeffCount());
            Assert.AreEqual(0x123UL, poly.Pointer[0]);
            Assert.AreEqual(0UL, poly.Pointer[1]);
            Assert.AreEqual(0x456UL, poly.Pointer[2]);
            Assert.AreEqual(0UL, poly.Pointer[3]);
            Assert.AreEqual(0x1234567812345678UL, poly.Pointer[4]);
            Assert.AreEqual(0x321UL, poly.Pointer[5]);

            var poly2 = new BigPoly(3, 64);

            poly2[0].Set(1);
            poly2[1].Set(2);
            poly2[2].Set(3);
            Assert.IsFalse(poly.Equals(poly2));
            Assert.IsFalse(poly2.Equals(poly));
            Assert.AreNotEqual(poly.GetHashCode(), poly2.GetHashCode());
            poly.Set(poly2);
            Assert.IsTrue(poly.Equals(poly2));
            Assert.IsTrue(poly2.Equals(poly));
            Assert.AreEqual(poly.GetHashCode(), poly2.GetHashCode());
            Assert.AreEqual("3x^2 + 2x^1 + 1", poly.ToString());
            Assert.AreEqual(1UL, poly.Pointer[0]);
            Assert.AreEqual(0UL, poly.Pointer[1]);
            Assert.AreEqual(2UL, poly.Pointer[2]);
            Assert.AreEqual(0UL, poly.Pointer[3]);
            Assert.AreEqual(3UL, poly.Pointer[4]);
            Assert.AreEqual(0UL, poly.Pointer[5]);

            poly[0].Set("123");
            poly[1].Set("456");
            poly[2].Set("3211234567812345678");
            poly.Resize(3, 32);
            Assert.AreEqual(3, poly.CoeffCount);
            Assert.AreEqual(32, poly.CoeffBitCount);
            Assert.AreEqual(3, poly.UInt64Count);
            Assert.AreEqual("12345678x^2 + 456x^1 + 123", poly.ToString());
            Assert.AreEqual(0x123UL, poly.Pointer[0]);
            Assert.AreEqual(0x456UL, poly.Pointer[1]);
            Assert.AreEqual(0x12345678UL, poly.Pointer[2]);

            poly.Resize(4, 100);
            Assert.AreEqual(4, poly.CoeffCount);
            Assert.AreEqual(100, poly.CoeffBitCount);
            Assert.AreEqual("12345678x^2 + 456x^1 + 123", poly.ToString());
            Assert.AreEqual(0x123UL, poly.Pointer[0]);
            Assert.AreEqual(0UL, poly.Pointer[1]);
            Assert.AreEqual(0x456UL, poly.Pointer[2]);
            Assert.AreEqual(0UL, poly.Pointer[3]);
            Assert.AreEqual(0x12345678UL, poly.Pointer[4]);
            Assert.AreEqual(0UL, poly.Pointer[5]);
            Assert.AreEqual(0UL, poly.Pointer[6]);
            Assert.AreEqual(0UL, poly.Pointer[7]);

            poly.Resize(0, 0);
            Assert.AreEqual(0, poly.CoeffCount);
            Assert.AreEqual(0, poly.CoeffBitCount);
            Assert.AreEqual(0, poly.UInt64Count);
            Assert.IsTrue(null == poly.Pointer);
            Assert.AreEqual(0, poly.GetSignificantCoeffCount());
            Assert.IsTrue(poly.IsZero);
            Assert.IsFalse(poly.IsAlias);
            Assert.AreEqual("0", poly.ToString());
        }
        public void PolyEvalPolyNET()
        {
            var polyToEval = new BigPoly("0");
            var poly       = new BigPoly("0");
            var result     = new BigPoly(Utilities.PolyEvalPoly(polyToEval, poly));

            Assert.IsTrue(result.ToString() == "0");

            polyToEval.Set("1");
            poly.Set("0");
            result.Set(Utilities.PolyEvalPoly(polyToEval, poly));
            Assert.IsTrue(result.ToString() == "1");

            polyToEval.Set("12345ABCDE");
            poly.Set("0");
            result.Set(Utilities.PolyEvalPoly(polyToEval, poly));
            Assert.IsTrue(result.ToString() == "12345ABCDE");

            polyToEval.Set("12345ABCDE");
            poly.Set("1");
            result.Set(Utilities.PolyEvalPoly(polyToEval, poly));
            Assert.IsTrue(result.ToString() == "12345ABCDE");

            polyToEval.Set("0");
            poly.Set("1");
            result.Set(Utilities.PolyEvalPoly(polyToEval, poly));
            Assert.IsTrue(result.ToString() == "0");

            polyToEval.Set("1x^1 + 2");
            poly.Set("1");
            result.Set(Utilities.PolyEvalPoly(polyToEval, poly));
            Assert.IsTrue(result.ToString() == "3");

            polyToEval.Set("1x^1 + FFFFFFF");
            poly.Set("2x^1 + 1");
            result.Set(Utilities.PolyEvalPoly(polyToEval, poly));
            Assert.IsTrue(result.ToString() == "2x^1 + 10000000");

            polyToEval.Set("1x^1 + 1");
            poly.Set("1x^100 + 2x^90 + 3x^80 + 4x^70 + 5x^60 + 6x^50 + 7x^40 + 8x^30 + 9x^20 + Ax^10 + B");
            result.Set(Utilities.PolyEvalPoly(polyToEval, poly));
            Assert.IsTrue(result.ToString() == "1x^100 + 2x^90 + 3x^80 + 4x^70 + 5x^60 + 6x^50 + 7x^40 + 8x^30 + 9x^20 + Ax^10 + C");

            polyToEval.Set("1x^2 + 1");
            poly.Set("1x^10 + 2x^9 + 3x^8 + 4x^7 + 5x^6 + 6x^5 + 7x^4 + 8x^3 + 9x^2 + Ax^1 + B");
            result.Set(Utilities.PolyEvalPoly(polyToEval, poly));
            Assert.IsTrue(result.ToString() == "1x^20 + 4x^19 + Ax^18 + 14x^17 + 23x^16 + 38x^15 + 54x^14 + 78x^13 + A5x^12 + DCx^11 + 11Ex^10 + 154x^9 + 17Dx^8 + 198x^7 + 1A4x^6 + 1A0x^5 + 18Bx^4 + 164x^3 + 12Ax^2 + DCx^1 + 7A");

            polyToEval.Set("1x^3 + 1x^2 + 1");
            poly.Set("1x^2 + 1x^1 + 1");
            result.Set(Utilities.PolyEvalPoly(polyToEval, poly));
            Assert.IsTrue(result.ToString() == "1x^6 + 3x^5 + 7x^4 + 9x^3 + 9x^2 + 5x^1 + 3");

            polyToEval.Set("1x^100 + 2x^95 + 3x^90 + Ax^75 + Bx^70 + Cx^65 + Dx^60 + Fx^30 + Ex^20 + Dx^10 + 1x^9 + 2x^8 + 3x^7 + 4x^6 + 5x^5 + 1x^2 + 1");
            poly.Set("1");
            result.Set(Utilities.PolyEvalPoly(polyToEval, poly));
            Assert.IsTrue(result.ToString() == "6F");

            polyToEval.Set("1x^100 + 2x^95 + 3x^90 + Ax^75 + Bx^70 + Cx^65 + Dx^60 + Fx^30 + Ex^20 + Dx^10 + 1x^9 + 2x^8 + 3x^7 + 4x^6 + 5x^5 + 1x^2 + 1");
            poly.Set("3");
            result.Set(Utilities.PolyEvalPoly(polyToEval, poly));
            Assert.IsTrue(result.ToString() == "5B05B5BB47C5083385621FA57ACC77AAFD787C71");
        }
Exemplo n.º 10
0
        public void ExponentiatePolyNET()
        {
            int exponent;
            var bigPoly = new BigPoly();
            var expPoly = new BigPoly();

            exponent = 0;
            bigPoly.Set("1");
            expPoly = Utilities.ExponentiatePoly(bigPoly, exponent);
            Assert.IsTrue(expPoly.ToString() == "1");

            exponent = 0;
            bigPoly.Set("1x^1 + A123");
            expPoly = Utilities.ExponentiatePoly(bigPoly, exponent);
            Assert.IsTrue(expPoly.ToString() == "1");

            exponent = 0;
            bigPoly.Set("Ax^2 + Bx^1 + 1234567890ABCDEF");
            expPoly = Utilities.ExponentiatePoly(bigPoly, exponent);
            Assert.IsTrue(expPoly.ToString() == "1");

            exponent = 1;
            bigPoly.Set("0");
            expPoly = Utilities.ExponentiatePoly(bigPoly, exponent);
            Assert.IsTrue(expPoly.ToString() == "0");

            exponent = 1;
            bigPoly.Set("1");
            expPoly = Utilities.ExponentiatePoly(bigPoly, exponent);
            Assert.IsTrue(expPoly.ToString() == "1");

            exponent = 1;
            bigPoly.Set("1x^2 + 2x^1 + A123");
            expPoly = Utilities.ExponentiatePoly(bigPoly, exponent);
            Assert.IsTrue(expPoly.ToString() == "1x^2 + 2x^1 + A123");

            exponent = 1;
            bigPoly.Set("1234567890ABCDEFx^10 + Ax^9 + Bx^1 + C");
            expPoly = Utilities.ExponentiatePoly(bigPoly, exponent);
            Assert.IsTrue(expPoly.ToString() == "1234567890ABCDEFx^10 + Ax^9 + Bx^1 + C");

            exponent = 2;
            bigPoly.Set("0");
            expPoly = Utilities.ExponentiatePoly(bigPoly, exponent);
            Assert.IsTrue(expPoly.ToString() == "0");

            exponent = 2;
            bigPoly.Set("1");
            expPoly = Utilities.ExponentiatePoly(bigPoly, exponent);
            Assert.IsTrue(expPoly.ToString() == "1");

            exponent = 2;
            bigPoly.Set("1x^1 + A123");
            expPoly = Utilities.ExponentiatePoly(bigPoly, exponent);
            Assert.IsTrue(expPoly.ToString() == "1x^2 + 14246x^1 + 656D0AC9");

            exponent = 2;
            bigPoly.Set("1x^10 + 2x^5 + 3");
            expPoly = Utilities.ExponentiatePoly(bigPoly, exponent);
            Assert.IsTrue(expPoly.ToString() == "1x^20 + 4x^15 + Ax^10 + Cx^5 + 9");

            exponent = 2;
            bigPoly.Set("A123x^20");
            expPoly = Utilities.ExponentiatePoly(bigPoly, exponent);
            Assert.IsTrue(expPoly.ToString() == "656D0AC9x^40");

            exponent = 123;
            bigPoly.Set("1");
            expPoly = Utilities.ExponentiatePoly(bigPoly, exponent);
            Assert.IsTrue(expPoly.ToString() == "1");

            exponent = 123;
            bigPoly.Set("5x^1");
            expPoly = Utilities.ExponentiatePoly(bigPoly, exponent);
            Assert.IsTrue(expPoly.ToString() == "30684B4BF0E5E24DC014B5AC590720EB9AD08D8DF6046110F8F5AF53B8A61F969267EC1Dx^123");
        }