passutil.cs
来自「工作流引擎」· CS 代码 · 共 45 行
CS
45 行
using System;
using System.Web;
using System.Security;
using System.Security.Cryptography;
namespace WorkFlow.util
{
/// <summary>
/// PassUtil 的摘要说明。
/// </summary>
public class PassUtil
{
public PassUtil()
{
//
// TODO: 在此处添加构造函数逻辑
//
}
// private static string md5(string str)
// { //16位
//
// return System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(str,"MD5").ToLower().Substring(8,16) ;
//
//
// }
public static string MD5(string str)
{
byte[] bValue;
byte[] bHash;
//string result=null;
MD5CryptoServiceProvider MD5=new MD5CryptoServiceProvider();
bValue=System.Text.Encoding.UTF8.GetBytes(str);
bHash = MD5.ComputeHash(bValue);
MD5.Clear();
return Convert.ToBase64String(bHash);
}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?