Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Convert 'String' to Base64 encode of MD5 'String' in c# .net

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

Please help me here

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

like image 492
Zaid Iqbal Avatar asked Sep 06 '25 03:09

Zaid Iqbal


1 Answers

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)

string password will result with X03MO1qnZdYdgyfeuILPmQ==

Update : converted to c# using online converter (I hope it's correctly converted)

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);
like image 54
nelek Avatar answered Sep 08 '25 00:09

nelek