public void Test() { for (int x = 0; x < 10000000; x++) { Guid value = Guid.NewGuid(); int hash1 = GetHash(value); int hash2 = GuidSHA1Helper.ComputeHash(value); if (hash1 != hash2) { throw new Exception(); } } }
public void ComputeCustom() { Guid value = Guid.NewGuid(); Stopwatch sw = new Stopwatch(); sw.Reset(); sw.Start(); for (int x = 0; x < 10000000; x++) { _ = GuidSHA1Helper.ComputeHash(value); } sw.Stop(); sw.Reset(); sw.Start(); for (int x = 0; x < 10000000; x++) { _ = GuidSHA1Helper.ComputeHash(value); } sw.Stop(); Console.WriteLine(10000000 / sw.Elapsed.TotalSeconds / 1000000); }