Makes a MD5 hash from a string : MD5 « Security « C# / C Sharp






Makes a MD5 hash from a string

 
using System;
using System.Security.Cryptography;
using System.Text;
public class EncryptionUtilities
{
    /// <summary>
    /// Makes a MD5 hash from a string
    /// </summary>
    /// <param name="inString">String to make a MD5 hash from</param>
    /// <returns>MD5 hash in the form of a Guid</returns>
    public Guid GetMd5Hash(string inString)
    {
        var unicodeEncoding = new UnicodeEncoding();
        var message = unicodeEncoding.GetBytes(inString);

        MD5 hashString = new MD5CryptoServiceProvider();

        return new Guid(hashString.ComputeHash(message));
    }
}

   
  








Related examples in the same category

1.MD5 encode
2.MD5 Encrypt
3.Create MD5 Hash
4.Create ASCII MD5 Hash
5.Encrypt MD5
6.MD5 Hash
7.MD5 Hash
8.Get MD5 Hash
9.Get MD5 Hash (2)
10.Computes the MD5 checksum for a single file.
11.Get MD5 for a string
12.Get and verify MD5 Hash
13.Md5 Hash (2)