Bạn có thể vào MSDN có hướng dẫn vào code demo cho bạn luôn.
Mình lấy code demo trong MSDN:
Visual C# Code:
namespace MD5Sample { class Program { { { Console.WriteLine("The MD5 hash of " + source + " is: " + hash + "."); Console.WriteLine("Verifying the hash..."); { Console.WriteLine("The hashes are the same."); } { Console.WriteLine("The hashes are not same."); } } } { // Convert the input string to a byte array and compute the hash. // Create a new Stringbuilder to collect the bytes // and create a string. // Loop through each byte of the hashed data // and format each one as a hexadecimal string. { sBuilder.Append(data[i].ToString("x2")); } // Return the hexadecimal string. } // Verify a hash against a string. { // Hash the input. // Create a StringComparer an compare the hashes. StringComparer comparer = StringComparer.OrdinalIgnoreCase; { } { } } } } // This code example produces the following output: // // The MD5 hash of Hello World! is: ed076287532e86365e841e92bfc50d8c. // Verifying the hash... // The hashes are the same.
Nguồn: http://msdn.microsoft.com/en-us/libr...raphy.md5.aspx