1.å¦ä½ç»å符串ç¨md5å å¯?码加密网站源码vip系统c#å®ç°ã
å¦ä½ç»å符串ç¨md5å å¯?c#å®ç°ã
楼ä¸çæåç»åºçæ¯å¨WebéçMD5å å¯æ¹æ³ï¼ä»¥ä¸æ¯å¨Winformçªä½ç¨åºä¸è¿è¡MD5å å¯çç®æ³ï¼
/// <summary>
/// å°æå®å符串è¿è¡MD5å å¯
/// </summary>
private string GetMD5str(string oldStr)
{
//å°è¾å ¥è½¬æ¢ä¸ºASCII å符ç¼ç
ASCIIEncoding enc = new ASCIIEncoding();
//å°å符串转æ¢ä¸ºåèæ°ç»
byte[] buffer = enc.GetBytes(oldStr);
//å建MD5å®ä¾
MD5 md5 = new MD5CryptoServiceProvider();
//è¿è¡MD5å å¯
byte[] hash = md5.ComputeHash(buffer);
StringBuilder sb = new StringBuilder();
//æ¼è£ å å¯åçå符
for (int i = 0; i < hash.Length; i++)
{
sb.AppendFormat("{ 0:x2}", hash[i]);
}
//è¾åºå å¯åçå符串
return sb.ToString();
}
æ¤å¤ï¼ç¨æ¤æ¹æ³æ¶éè¦æ·»å
using System.Security.Cryptography;
å½å空é´