Exemple #1
0
        public void TestCharge()
        {
            Stopwatch sw = new Stopwatch();

            sw.Start();

            for (int i = 0; i < 10000; i++)
            {
                string Source = KeyGenerator.GetUniqueKey(10000);
                var    zaz    = new SecurityExtention.Obscure(_XorKey).Encoder(Source, SecurityExtention.ObscureStringMode.ASCII);
                string Result = new SecurityExtention.Obscure(_XorKey).Dec_String(zaz, SecurityExtention.ObscureStringMode.ASCII);

                Assert.AreEqual(Source, Result);
            }
            sw.Stop();

            Console.WriteLine($" - {sw.ElapsedTicks}");
        }
Exemple #2
0
        public void TestChargeParallel()
        {
            Stopwatch sw = new Stopwatch();

            sw.Start();

            Parallel.For(0, 1100000, Index =>
            {
                string Source = KeyGenerator.GetUniqueKey(509);
                var zaz       = new SecurityExtention.Obscure(_XorKey).Encoder(Source, SecurityExtention.ObscureStringMode.ASCII);

                // Assert.IsFalse(string.IsNullOrWhiteSpace(zaz) || zaz.Length % 4 != 0);

                string Result = new SecurityExtention.Obscure(_XorKey).Dec_String(zaz, SecurityExtention.ObscureStringMode.ASCII);

                Assert.AreEqual(Source, Result);
            }
                         );
            sw.Stop();

            Console.WriteLine($" - {sw.ElapsedTicks}");
        }