Last active
October 23, 2016 17:35
-
-
Save DvdKhl/91f7afa8b75d93a2149206c9b199aa90 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Diagnostics; | |
using System.Security.Cryptography; | |
namespace SHA1Test { | |
class Program { | |
static void Main(string[] args) { | |
var sha = SHA1.Create(); | |
var sw = new Stopwatch(); | |
sw.Start(); | |
var b = new byte[4 * (1 << 20)]; | |
long iterations = 10 * (1L << 30) / b.Length; | |
for(int i = 0; i < iterations; i++) { | |
sha.TransformBlock(b, 0, b.Length, null, 0); | |
} | |
var hash = sha.TransformFinalBlock(new byte[0], 0, 0); | |
Console.WriteLine(sw.ElapsedMilliseconds); | |
Console.Read(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment