修改md5加密使用utf-8编码

This commit is contained in:
2018-11-08 00:30:58 +08:00
parent 683cea53b0
commit ce3dafa9ea
3 changed files with 6 additions and 4 deletions
+2 -2
View File
@@ -325,7 +325,7 @@ namespace COMCMS.Common
{
using (var md5 = System.Security.Cryptography.MD5.Create())
{
var result = md5.ComputeHash(Encoding.ASCII.GetBytes(str));
var result = md5.ComputeHash(Encoding.UTF8.GetBytes(str));
var strResult = BitConverter.ToString(result);
return strResult.Replace("-", "");
}
@@ -339,7 +339,7 @@ namespace COMCMS.Common
{
using(var sha256 = System.Security.Cryptography.SHA256.Create())
{
var result = sha256.ComputeHash(Encoding.ASCII.GetBytes(str));
var result = sha256.ComputeHash(Encoding.UTF8.GetBytes(str));
var strResult = BitConverter.ToString(result);
return strResult.Replace("-", "");
}