コード例 #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);
        }
コード例 #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);
        }
コード例 #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);
            }
        }