在C#.NET将'字符串'为Base64恩MD5'串'的code [英] Convert 'String' to Base64 encode of MD5 'String' in c# .net

查看:352
本文介绍了在C#.NET将'字符串'为Base64恩MD5'串'的code的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我怎么能转换我的密码字符串'为Base64恩MD5'串'的code。像这样的字符串'密码'到' X03MO1qnZdYdgyfeuILPmQ ==

How can i Convert my password 'String' to Base64 encode of MD5 'String'. Like this string 'password' to 'X03MO1qnZdYdgyfeuILPmQ=='.

请帮我在这里

或只是让我知道的技术,我怎么可以转换这个密码'到' X03MO1qnZdYdgyfeuILPmQ == 。我将code它自己

OR just let me know the technique that how can i convert this 'password' to 'X03MO1qnZdYdgyfeuILPmQ=='. i will code it myself

推荐答案

好吧,还有例子(vb.net中,我将尝试使用一些网上的转换器在C#中转换):

Ok, there is example (vb.net, I'll try to convert in c# using some online converter) :

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)

字符串密码将导致与 X03MO1qnZdYdgyfeuILPmQ ==

更新:使用网上转换器(我希望这是正确转换)

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#.NET将'字符串'为Base64恩MD5'串'的code的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆