public double Run() { PerfWatch t = new PerfWatch(); byte[] key = new byte[(keybits + 7) / 8]; byte[] input = new byte[megabytes * 1048576]; byte[] output = new byte[megabytes * 1048576]; t.Start(); t.Stop(); using (Blockcipher bc = new Blockcipher(cipherkind)) { byte[] iv = new byte[bc.Blocksize]; bc.SetMode(ciphermode); bc.SetKey(keytype, key, keybits); bc.SetIV(iv); bc.Update(input, output); GC.Collect(); t.Start(); bc.Update(input, output); t.Stop(); } GC.Collect(); return megabytes / t.seconds(); }
public double Run() { byte[] seed = new byte[] { 0x01, 0x23, 0x02, 0x34, 0x03, 0x45, 0x04, 0x56 }; PerfWatch t = new PerfWatch(); byte[] output = new byte[megabytes * 1048576]; t.Start(); t.Stop(); using (Prng prng = new Prng(Prng)) { prng.SetSeed(seed); prng.Update(output); prng.SetSeed(seed); GC.Collect(); t.Start(); prng.Update(output); t.Stop(); } GC.Collect(); return megabytes / t.seconds(); }
public double Run() { PerfWatch t = new PerfWatch(); byte[] key = new byte[(keybits + 7) / 8]; byte[] input = new byte[megabytes * 1048576]; byte[] output = new byte[megabytes * 1048576]; t.Start(); t.Stop(); using (Streamcipher sc = new Streamcipher(cipherkind, keybits)) { sc.SetKey(key, null); sc.Update(input, output); GC.Collect(); t.Start(); sc.Update(input, output); t.Stop(); } GC.Collect(); return megabytes / t.seconds(); }
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(); }