WinForm MD5加密,校验是否加密过,
MD5加密方法:
/// <summary>
/// MD5加密
/// </summary>
/// <param name="myString">加密文本</param>
/// <returns>密文</returns>
public static string Md5(string myString)
{
return FormsAuthentication.HashPasswordForStoringInConfigFile(myString, "MD5");
}
/// <summary>
/// 判断是否加密过
/// </summary>
/// <param name="mystring"></param>
/// <returns></returns>
public static bool IsEncryption(string mystring)
{
bool result;
if (mystring.Length==32)
{
result = true;
}
else
{
result = false;
}
return result;
}