public static string Encrypt(string cleanstring)
{
Byte[] clearBytes = new UnicodeEncoding().GetBytes(cleanstring);
byte[] hashedBytes = ((HashAlgorithm)CryptoConfig.CreateFromName("MD5")).ComputeHash(clearBytes);
return BitConverter.ToString(hashedBytes);
}

本文介绍了一个使用MD5算法进行字符串加密的公共静态方法。该方法首先将输入的字符串转换为Unicode字节,然后利用MD5散列算法计算这些字节的哈希值,并最终返回哈希值的字符串表示形式。
537

被折叠的 条评论
为什么被折叠?



