Mega Code Archive

 
Categories / C# / Security
 

Password Encrypter

using System; using System.Net; using System.Security.Cryptography; using System.Text; using System.Windows; using System.Windows.Controls; using System.Windows.Documents; using System.Windows.Ink; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Animation; using System.Windows.Shapes; namespace Bonefisher.Silverlight.Utilities {     public static class PasswordEncrypter     {         public static string Encrypt(this string plaintextPassword)         {             HashAlgorithm mhash = new SHA1Managed();             byte[] bytValue = Encoding.UTF8.GetBytes(plaintextPassword);             byte[] bytHash = mhash.ComputeHash(bytValue);             mhash.Clear();             return Convert.ToBase64String(bytHash);         }     } }