From 0ceca838df4a919186e6c11e696898b13f139b20 Mon Sep 17 00:00:00 2001 From: leenan <744976619@qq.com> Date: Sun, 8 May 2022 14:27:43 +0800 Subject: [PATCH] =?UTF-8?q?=E5=87=BD=E6=95=B0=E5=90=8D=E6=94=B9=E4=B8=BAMD?= =?UTF-8?q?5EncryptBase64?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SwiftCode.BBS.Common/Helper/MD5Helper.cs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/SwiftCode.BBS.Common/Helper/MD5Helper.cs b/SwiftCode.BBS.Common/Helper/MD5Helper.cs index 88b1bf3..6002eab 100644 --- a/SwiftCode.BBS.Common/Helper/MD5Helper.cs +++ b/SwiftCode.BBS.Common/Helper/MD5Helper.cs @@ -53,17 +53,19 @@ public static string MD5Encrypt32(string password = "") } /// - /// 64位MD5加密 + /// MD5加密,base64编码 /// /// /// - public static string MD5Encrypt64(string password) + //public static string MD5Encrypt64(string password) + public static string MD5Encrypt64Base64(string password) { // 实例化一个md5对像 // 加密后是一个字节类型的数组,这里要注意编码UTF8/Unicode等的选择  MD5 md5 = MD5.Create(); - byte[] s = md5.ComputeHash(Encoding.UTF8.GetBytes(password)); - return Convert.ToBase64String(s); + byte[] s = md5.ComputeHash(Encoding.UTF8.GetBytes(password)); //16字节数组 + return Convert.ToBase64String(s); //生成的base64字符串长度是24 + //所以建议将函数名改为MD5EncryptBase64 } }