You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
995 B
28 lines
995 B
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace BBWYB.Client.Helpers
|
|
{
|
|
public class Md5Helper
|
|
{
|
|
//32位小写
|
|
public static string Md5_32(string str)
|
|
{
|
|
string cl = str;
|
|
string pwd = "";
|
|
System.Security.Cryptography.MD5 md5 = System.Security.Cryptography.MD5.Create();//实例化一个md5对像
|
|
// 加密后是一个字节类型的数组,这里要注意编码UTF8/Unicode等的选择
|
|
byte[] s = md5.ComputeHash(System.Text.Encoding.UTF8.GetBytes(cl));
|
|
// 通过使用循环,将字节类型的数组转换为字符串,此字符串是常规字符格式化所得
|
|
for (int i = 0; i < s.Length; i++)
|
|
{
|
|
//将得到的字符串使用16进制类型格式
|
|
pwd = pwd + s[i].ToString("X");
|
|
}
|
|
return pwd.ToLower();
|
|
}
|
|
}
|
|
}
|
|
|