/*******************************************************************************
|
* Copyright © 2016 NFine.Framework 版权所有
|
* Author: NFine
|
* Description: NFine快速开发平台
|
* Website:http://www.nfine.cn
|
*********************************************************************************/
|
namespace Common
|
{
|
/// <summary>
|
/// MD5加密
|
/// </summary>
|
public class Md5Helper
|
{
|
/// <summary>
|
/// MD5加密
|
/// </summary>
|
/// <param name="str">加密字符</param>
|
/// <param name="code">加密位数16/32</param>
|
/// <returns></returns>
|
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;
|
}
|
}
|
}
|