Ejemplo n.º 1
0
        public void TestULongEncryptionZero()
        {
            ulong plain = 0;

            var enc = FPEWrapper.EncryptULong(key, tweak, plain);
            var dec = FPEWrapper.DecryptULong(key, tweak, enc);

            Assert.AreEqual(plain, dec);
        }
Ejemplo n.º 2
0
        public void TestULongEncryptionMin()
        {
            ulong plain = ulong.MinValue + 1;

            var enc = FPEWrapper.EncryptULong(key, tweak, plain);
            var dec = FPEWrapper.DecryptULong(key, tweak, enc);

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

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

                var enc = FPEWrapper.EncryptULong(key, tweak, plain);
                var dec = FPEWrapper.DecryptULong(key, tweak, enc);

                Assert.AreEqual(plain, dec);
            }
        }