This class is a wrapper class for working with the MD5CryptoServiceProvider, it contains a single static method called GenerateHash

Namespace:  CA.Common.Security.Cryptography
Assembly:  CA.Common (in CA.Common.dll) Version: 1.0.0.0 (1.0.0.0)

Remarks

A simple wrapper function to the MD5CryptoServiceProvider.

CopyFull Source Code for the MD5 class
//Source code from the Code Associate C# code library, Full documentation and latest updates can be found
//@ http://www.codeassociate.com/caapi/
using System;
using System.Security.Cryptography;

namespace CA.Common.Security.Cryptography
{
    public class MD5
    {
        public static string GenerateHash(string input)
        {
            MD5CryptoServiceProvider oMD5;
            Byte[] bByte, bResult;

            oMD5 = new MD5CryptoServiceProvider();
            bByte = new Byte[input.Length];

            for (int i = 0; i < input.Length; i++)
            {
                bByte[i] = Convert.ToByte(input[i]);
            }
            bResult = oMD5.ComputeHash(bByte);
            return Convert.ToBase64String(bResult);
        }       

        public static string GenerateCaseInsensitiveHash(string input)
        {
            return GenerateHash(input.ToLower());
        }
    }
}

Inheritance Hierarchy

System..::.Object
  CA.Common.Security.Cryptography..::.MD5

See Also