예제 #1
0
        public void TestDecimalEncryptionMinPlusTwo()
        {
            Decimal initial        = FPEWrapper.MinAllowedDecimal + 0.00002M;
            var     encryptedValue = FPEWrapper.EncryptDecimal(key, tweak, initial);
            var     decryptedValue = FPEWrapper.DecryptDecimal(key, tweak, encryptedValue);

            Assert.AreEqual(initial, decryptedValue);
        }
예제 #2
0
        public void TestDecimalEncryptionMinusOne()
        {
            Decimal initial        = -1;
            var     encryptedValue = FPEWrapper.EncryptDecimal(key, tweak, initial);
            var     decryptedValue = FPEWrapper.DecryptDecimal(key, tweak, encryptedValue);

            Assert.AreEqual(initial, decryptedValue);
        }
예제 #3
0
        public void TestDecimalEncryptionFiveDecimalPoints()
        {
            Decimal initial        = 0.00001M;
            var     encryptedValue = FPEWrapper.EncryptDecimal(key, tweak, initial);
            var     decryptedValue = FPEWrapper.DecryptDecimal(key, tweak, encryptedValue);

            Assert.AreEqual(initial, decryptedValue);
        }
예제 #4
0
        public void StressTestDecimalEncryption()
        {
            Random r     = new Random();
            int    times = 10000;

            for (int i = 0; i < times; i++)
            {
                Decimal plain = r.Next(int.MinValue + 2, int.MaxValue - 2);
                var     enc   = FPEWrapper.EncryptDecimal(key, tweak, plain);
                var     dec   = FPEWrapper.DecryptDecimal(key, tweak, enc);
                Console.WriteLine($"Src:{enc}, Dest:{dec}");
                Assert.AreEqual(plain, dec);
            }
        }
예제 #5
0
 public void TestDecimalEncryptionMinPlusOne()
 {
     FPEWrapper.EncryptDecimal(key, tweak, FPEWrapper.MinAllowedDecimal + 0.00001M);
 }
예제 #6
0
 public void TestDecimalEncryptionMin()
 {
     FPEWrapper.EncryptDecimal(key, tweak, FPEWrapper.MinAllowedDecimal);
 }
예제 #7
0
 public void TestDecimalEncryptionMaxMinusOne()
 {
     FPEWrapper.EncryptDecimal(key, tweak, FPEWrapper.MaxAllowedDecimal - 0.00001M);
 }