Пример #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);
 }