1. 程式人生 > >MD5加密的代碼

MD5加密的代碼

span bytes pty empty encrypt pub hash ret pre

/*
將字符串轉utf8 byte[]數組。
*/

public class MD5Helper { public static string Encrypt(string str) { string encryptStr = string.Empty; MD5 md5 = MD5.Create(); byte[] buffer = md5.ComputeHash(Encoding.UTF8.GetBytes(str)); foreach (var b in buffer) { encryptStr
+= b.ToString("X"); } return encryptStr; } }

MD5加密的代碼