/*******************************************************************************
* Copyright © 2016 NFine.Framework 版权所有
* Author: NFine
* Description: NFine快速开发平台
* Website:http://www.nfine.cn
*********************************************************************************/
namespace Common
{
///
/// MD5加密
///
public class Md5Helper
{
///
/// MD5加密
///
/// 加密字符
/// 加密位数16/32
///
public static string Md5(string str, int code)
{
string strEncrypt = string.Empty;
if (code == 16)
{
strEncrypt = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(str, "MD5").Substring(8, 16);
}
if (code == 32)
{
strEncrypt = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(str, "MD5");
}
return strEncrypt;
}
}
}