Daniel M. Hendricks

MD5 String Hash

The following code shows a simple method for generating an MD5 hash of a string.

<%@ Page Language="C#" Debug="true" %>
<%@ Import Namespace="System.Web" %>
<%@ Import Namespace="System.Security.Cryptography" %>



<%
string string_to_encode = "String to Encode";
Response.Write("Original: " + string_to_encode + "");
Response.Write("MD5 Hash: " + GetMD5(string_to_encode));
%>

The above code produces the following output:

Original: String to Encode
MD5 Hash: 0a2f22d5bcb440dd55d79478e8e876eb

Post a Comment

You must be logged in to post a comment.

Tip: Sign up for a free Gravatar to have a photo next to your comment! Your gravatar will follow you around when you post to blogs that support it, based on the e-mail address you use to post.