Password encyption

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • gyap88
    New Member
    • Jul 2007
    • 37

    Password encyption

    Hi everyone, I m using visual studio 2005 and microsoft sql server to build my project.

    My website consist of a registration page. I m interested to know how to save the text in the password field in a encrypted form in the mssql database.
    What will be the appropriate data type of the column in the database?
  • kenobewan
    Recognized Expert Specialist
    • Dec 2006
    • 4871

    #2
    Depends on the method of encryption:
    Encrypting Sensitive Data in a Database

    Comment

    • gyap88
      New Member
      • Jul 2007
      • 37

      #3
      Originally posted by kenobewan
      Depends on the method of encryption:
      Encrypting Sensitive Data in a Database

      Sorry the link is invalid..

      Comment

      • kenobewan
        Recognized Expert Specialist
        • Dec 2006
        • 4871

        #4
        Originally posted by gyap88
        Sorry the link is invalid..
        My bad - http://aspnet.4guysfromrolla.com/articles/081705-1.aspx

        Comment

        • wimpos
          New Member
          • Jan 2008
          • 19

          #5
          For storing passwords you should use an algorithm that has one way encryption, so it can be decrypted. md5 or hash , ...

          User registers:
          - choose password: mypass
          - Hashed: o5d4g44f
          - stored in database

          User logs in
          - user types password: mypass
          - password hashed: o5d4g44f
          - check if hash in database is the same

          Comment

          • kevin111
            New Member
            • Jan 2008
            • 4

            #6
            MD5 is good, when the message is encrypted, the length of the encrypted message will be a constant, 16 or 32
            decryption is not needed, when a user submit a password, encrypt it, then compare with the encrypted password saved in database

            [CODE=cpp] public static string GetMD5(string source)
            {
            string result = "";

            MD5 md5 = MD5.Create();
            byte[] buffer = md5.ComputeHash (System.Text.En coding.Unicode. GetBytes(source ));
            for (int i = 0; i < buffer.Length; i++)
            {
            result += buffer[i].ToString("X2") ;
            }

            return result;
            }[/CODE]

            don't forget "using System.Security .Cryptography"

            Comment

            Working...