Skip to content

Instantly share code, notes, and snippets.

@DvdKhl
Last active October 23, 2016 17:35
Show Gist options
  • Save DvdKhl/91f7afa8b75d93a2149206c9b199aa90 to your computer and use it in GitHub Desktop.
Save DvdKhl/91f7afa8b75d93a2149206c9b199aa90 to your computer and use it in GitHub Desktop.
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