Password Encrypter : Password « Security « C# / C Sharp






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);
        }
    }

}

   
    
  








Related examples in the same category

1.Directory Services Change PasswordDirectory Services Change Password
2.Utility class for encrypting passwords and comparing two encrypted passwords.
3.Send Password Email
4.Get Random Password Using GUID