public void RFC1319_b(string testName, MD2 hash, byte[] input, byte[] result) { byte[] output = hash.ComputeHash(input, 0, input.Length); AssertEquals(testName + ".b.1", result, output); AssertEquals(testName + ".b.2", result, hash.Hash); // required or next operation will still return old hash hash.Initialize(); }
public void RFC1319_c(string testName, MD2 hash, byte[] input, byte[] result) { MemoryStream ms = new MemoryStream(input); byte[] output = hash.ComputeHash(ms); AssertEquals(testName + ".c.1", result, output); AssertEquals(testName + ".c.2", result, hash.Hash); // required or next operation will still return old hash hash.Initialize(); }
public static string Md2Crypto(string source) { using (MD2 myMD2 = MD2.Create()) { try { byte[] input = Encoding.UTF8.GetBytes(source); byte[] output = myMD2.ComputeHash(input); string hashstr = GetHexStrByteArray(output); return(hashstr); } catch (Exception e) { Console.WriteLine(e); throw; } } }