//http://activedeveloperdk.codeplex.com/
//The MIT License (MIT)
using System;
using System.Security.Cryptography;
using System.Security;
using System.IO;
using System.Text;
namespace ActiveDeveloper.Core.Utilities
{
public class Encryption
{
public static string MD5Encrypt ( string phrase )
{
UTF8Encoding encoder = new UTF8Encoding();
MD5CryptoServiceProvider md5hasher = new MD5CryptoServiceProvider();
byte[] hashedDataBytes = md5hasher.ComputeHash( encoder.GetBytes( phrase ) );
return byteArrayToString( hashedDataBytes );
}
private static string byteArrayToString ( byte[] inputArray )
{
StringBuilder output = new StringBuilder( "" );
for ( int i = 0; i < inputArray.Length; i++ ) {
output.Append( inputArray[i].ToString( "X2" ) );
}
return output.ToString();
}
}
}