如何将我的密码“字符串”转换为 MD5“字符串”的 Base64 编码。像这个字符串 'password' 到 'X03MO1qnZdYdgyfeuILPmQ=='。
请帮帮我
或者让我知道如何将此“密码”转换为“X03MO1qnZdYdgyfeuILPmQ==”的技巧。我会自己编码
最佳答案
好的,有示例(vb.net,我将尝试使用一些在线转换器在 c# 中进行转换):
Dim pwd As String = "password"
Dim hs As System.Security.Cryptography.MD5 = System.Security.Cryptography.MD5.Create
Dim db As Byte() = hs.ComputeHash(System.Text.Encoding.UTF8.GetBytes(pwd))
Dim result As String = Convert.ToBase64String(db)
string password 的结果为 X03MO1qnZdYdgyfeuILPmQ==
更新:已使用在线转换器转换为 c#(我希望它已正确转换)
string pwd = "password";
System.Security.Cryptography.MD5 hs = System.Security.Cryptography.MD5.Create;
byte[] db = hs.ComputeHash(System.Text.Encoding.UTF8.GetBytes(pwd));
string result = Convert.ToBase64String(db);
关于c# - 在c#.net中将 'String'转换为MD5 'String'的Base64编码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33719689/