コード例 #1
0
        public void TestLongEncryptionMinPlusTwo()
        {
            long initial        = long.MinValue + 2;
            var  encryptedValue = FPEWrapper.EncryptLong(key, tweak, initial);
            var  decryptedValue = FPEWrapper.DecryptLong(key, tweak, encryptedValue);

            Assert.AreEqual(initial, decryptedValue);
        }
コード例 #2
0
        public void TestLongEncryptionMinusOne()
        {
            long initial        = -1;
            var  encryptedValue = FPEWrapper.EncryptLong(key, tweak, initial);
            var  decryptedValue = FPEWrapper.DecryptLong(key, tweak, encryptedValue);

            Assert.AreEqual(initial, decryptedValue);
        }
コード例 #3
0
        public void StressTestLongEncryption()
        {
            Random r     = new Random();
            int    times = 10000;

            for (int i = 0; i < times; i++)
            {
                int plain = r.Next(int.MinValue + 2, int.MaxValue - 2);
                var enc   = FPEWrapper.EncryptLong(key, tweak, plain);
                var dec   = FPEWrapper.DecryptLong(key, tweak, enc);
                Console.WriteLine($"Src:{enc}, Dest:{dec}");
                Assert.AreEqual(plain, dec);
            }
        }
コード例 #4
0
 public void TestLongEncryptionMinPlusOne()
 {
     FPEWrapper.EncryptLong(key, tweak, long.MinValue + 1);
 }
コード例 #5
0
 public void TestLongEncryptionMin()
 {
     FPEWrapper.EncryptLong(key, tweak, long.MinValue);
 }
コード例 #6
0
 public void TestLongEncryptionMaxMinusOne()
 {
     FPEWrapper.EncryptLong(key, tweak, long.MaxValue - 1);
 }