.Net Core 密码加密
1.现在api中创建一个的类
2.引用命名空间
|
1
|
using System.Security.Cryptography; |
3.在往类中添加以下代码
|
1
2
3
4
5
6
7
8
9
10
11
|
public static string CreateMd5(string inputValue) { //32位大写 using (var md5 = MD5.Create()) { var result = md5.ComputeHash(Encoding.UTF8.GetBytes(inputValue)); var strResult = BitConverter.ToString(result); string result3 = strResult.Replace("-", ""); return result3; } } |
4.然后回到我们的显示方法把我们的密码重新赋值


浙公网安备 33010602011771号