public bool Test() { bool res = false; byte[] digest = null; using (Hash hash = new Hash(Hashsum, OutputBits)) { digest = new byte[(OutputBits + 7) / 8]; hash.Update(_message, _message == null ? 0 : _message.Length); hash.Final(digest); res = DigestMatch(digest); } return res; }
public double Run() { PerfWatch t = new PerfWatch(); byte[] digest = new byte[(DigestBits + 7) / 8]; byte[] input = new byte[megabytes * 1048576]; t.Start(); t.Stop(); using (Hash hash = new Hash(Hashsum, 0)) { hash.Update(input, input.Length); hash.Final(digest); hash.Reset(); GC.Collect(); t.Start(); hash.Update(input, input.Length); hash.Final(digest); t.Stop(); } GC.Collect(); return megabytes / t.seconds(); }