Exemplo n.º 1
0
        public void GlobalSetup()
        {
            Rand = new Random(1258);

            KE = new InsideKeyEngine();

            TS = TimeSpan.FromHours(12);
        }
Exemplo n.º 2
0
        public static void FunctionalityTest()
        {
            var KE = new InsideKeyEngine();

            var x = KE.GenCode(TimeSpan.FromHours(42));

            Console.WriteLine(x);

            var Expiry = KE.Decode(x);

            Console.WriteLine(InsideHelper.TimeSpanToWords(Expiry - DateTime.UtcNow));
        }
Exemplo n.º 3
0
        public static void BenchmarkMultiThreaded()
        {
            var KE = new InsideKeyEngine();

            var CachedTimeSpan = TimeSpan.FromHours(42);

            var SW = new Stopwatch();

            SW.Restart();

            Parallel.For(0, Environment.ProcessorCount, _ =>
            {
                for (int I = 1; I <= 5_000_000; I++)
                {
                    var x = KE.GenCode(CachedTimeSpan);
                }
            });

            SW.Stop();

            Console.WriteLine(SW.ElapsedMilliseconds);
        }