public void HMACRIPEMD160_d(string testName, HMACRIPEMD160 hmac, byte[] input, byte[] result) { hmac.TransformFinalBlock(input, 0, input.Length); Assert.AreEqual(result, hmac.Hash, testName + ".d"); // required or next operation will still return old hash hmac.Initialize(); }
public void HMACRIPEMD160_b(string testName, HMACRIPEMD160 hmac, byte[] input, byte[] result) { byte[] output = hmac.ComputeHash(input, 0, input.Length); Assert.AreEqual(result, output, testName + ".b.1"); Assert.AreEqual(result, hmac.Hash, testName + ".b.2"); // required or next operation will still return old hash hmac.Initialize(); }
public void HMACRIPEMD160_c(string testName, HMACRIPEMD160 hmac, byte[] input, byte[] result) { MemoryStream ms = new MemoryStream(input); byte[] output = hmac.ComputeHash(ms); Assert.AreEqual(result, output, testName + ".c.1"); Assert.AreEqual(result, hmac.Hash, testName + ".c.2"); // required or next operation will still return old hash hmac.Initialize(); }
public void HMACRIPEMD160_e(string testName, HMACRIPEMD160 hmac, byte[] input, byte[] result) { byte[] copy = new byte [input.Length]; for (int i = 0; i < input.Length - 1; i++) { hmac.TransformBlock(input, i, 1, copy, i); } hmac.TransformFinalBlock(input, input.Length - 1, 1); Assert.AreEqual(result, hmac.Hash, testName + ".e"); // required or next operation will still return old hash hmac.Initialize(); }