Exemplo n.º 1
0
        public void TestUIntEncryptionMin()
        {
            uint plain = uint.MinValue + 1;

            var enc = FPEWrapper.EncryptUInt(key, tweak, plain);
            var dec = FPEWrapper.DecryptUInt(key, tweak, enc);

            Assert.AreEqual(plain, dec);
        }
Exemplo n.º 2
0
        public void TestUIntEncryptionZero()
        {
            uint plain = 0;

            var enc = FPEWrapper.EncryptUInt(key, tweak, plain);
            var dec = FPEWrapper.DecryptUInt(key, tweak, enc);

            Assert.AreEqual(plain, dec);
        }
Exemplo n.º 3
0
        public void TestUIntEncryptionRandom()
        {
            Random r     = new Random();
            int    times = 1000;

            for (int i = 0; i < times; i++)
            {
                uint plain = (uint)r.Next(0, int.MaxValue);

                var enc = FPEWrapper.EncryptUInt(key, tweak, plain);
                var dec = FPEWrapper.DecryptUInt(key, tweak, enc);

                Assert.AreEqual(plain, dec);
            }
        }