C# 計算MD5雜湊字串
public static string CalculateMD5Hash(string input) { // step 1, calculate MD5 hash from input var md5 = MD5.Create(); byte[] inputBytes = Encoding.ASCII.GetBytes(input); byte[] hash = md5.ComputeHash(inputBytes); // step 2, convert byte array to hex string var sb = new StringBuilder(); for (int i = 0; i < hash.Length; i++) { sb.Append(hash[i].ToString("X2")); } return sb.ToString(); }
以上就是C# 計算MD5雜湊字串的內容,更多相關內容請關注PHP中文網(www.php.cn)!