Created
October 13, 2014 15:29
-
-
Save imbaker/75375ee1d150265adf94 to your computer and use it in GitHub Desktop.
Encode Password
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Security.Cryptography; | |
using System.Text; | |
public class Program | |
{ | |
public static void Main() | |
{ | |
Console.WriteLine(EncodePassword("Pa55w0rd")); | |
} | |
public static string EncodePassword(string cleanString) | |
{ | |
byte[] clearBytes; | |
clearBytes = new UnicodeEncoding().GetBytes(cleanString); | |
byte[] hashedBytes = ((HashAlgorithm)(CryptoConfig.CreateFromName("MD5"))).ComputeHash(clearBytes); | |
string hashedText = BitConverter.ToString(hashedBytes); | |
return hashedText; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment