Encryptpassword.cs

using System;

using System.Web.Security;

using System.Security.Cryptography;

using System.Text;

using System.Text.RegularExpressions;

 

namespace prjstart.Components

{

       // This class ensures that the password is encypted using MD% hash algorithm and put it in the employee database.

       public class encryptpass

       {

              public static string protectpassword(string newpass)

              {

                     Byte[] clearbytes = new UnicodeEncoding().GetBytes(newpass);

                     Byte[] hashedpass = ((HashAlgorithm)CryptoConfig.CreateFromName("MD5")).ComputeHash(clearbytes);

                     return BitConverter.ToString(hashedpass);     // Send the passsowrd to this method and see that it converts this into a encrypted password.

 

 

              }

 

              public encryptpass()

              {

                     //

                     // TODO: Add constructor logic here

                     //

              }

       }

}

 

 

Back to the Main Page