Skip to content

Instantly share code, notes, and snippets.

@imbaker
Created October 13, 2014 15:29
Show Gist options
  • Save imbaker/75375ee1d150265adf94 to your computer and use it in GitHub Desktop.
Save imbaker/75375ee1d150265adf94 to your computer and use it in GitHub Desktop.
Encode Password
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