Encrypt MD5

image_pdfimage_print
   
 
//-----------------------------------------------------------------------
// <copyright file="CryptoUtil.cs" company="Pyramid Consulting">
//     Copyright (c) Pyramid Consulting. All rights reserved.
//  khoa.tran - 15-Dec-2007
// </copyright>
//-----------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.Text;
using System.Security.Cryptography;

namespace Bamboo.Core.Common.Crypto
{
    public class CryptoUtil
    {
        public static string EncryptMD5(string value)
        {
            MD5CryptoServiceProvider md5 = new MD5CryptoServiceProvider();
            byte[] byteValue = System.Text.Encoding.UTF8.GetBytes(value);
            byte[] byteHash = md5.ComputeHash(byteValue);

            return Convert.ToBase64String(byteHash);
        }

    }
}

   
     


This entry was posted in Security. Bookmark the permalink.