Password encryption

I am creating a login screen for an application in C #. In my login screen, I read the username and password from the database and verify that the username and password entered are correct. I need a password for encryption when I read the password form in the database. Can anyone explain how encryption and decryption work.

  • Should I store the encrypted value in the database for reading.
  • I now have two fields

    column names: username         password 
    
    values:        admin            password
    
  • Should I store the encrypted password value in another field in the login table?

+3
source share
5 answers

-: , , ( SHA-1 , MD5, ). , , , .

EDIT: ? , , ( ). , ( ). , , , , .

EDIT: ? , , . , , -, , , .

, ,

: http://www.obviex.com/samples/hash.aspx

, , reset, :

  • reset
  • ( /PIN-), , reset .
  • , .

14 2012 : , . - . bcrypt, ( ) scrypt.

? ! . (, CUDA nVidia) - , .

bcrypt : http://codahale.com/how-to-safely-store-a-password/

-: ( , , DoB, ,...) ( ). .

+14

:

# BCrypt.Net, iBCrypt: , , Visual Studio.Net:

BCrypt .NET - , SHA MD5.

, SO , .

+1

? Microsoft.Security microsoft. Membership, , . , () . Membership.CreateUser Membership.ValidateUser. ( ), .

0

. , , db.

Md5 , . , , reset.

, !

-1

.

- MD5. , .

#region Encrypt
public string Encrypt(string simpletext, string keys)
{
    try
    {
        XCryptEngine xe = new XCryptEngine();

        xe.Algorithm = XCrypt.XCryptEngine.AlgorithmType.DES; //DES = Data Encryption Standard

        string cipher = xe.Encrypt(simpletext, keys);
        if (cipher != null)
            return (cipher);
        else
            return null;
    }

    catch (Exception ex)
    {
        throw ex;
    }
}
#endregion

#region Decrypt
public string Decrypt(string simpletext, string keys)
{
    try
    {
        XCryptEngine xe = new XCryptEngine();

        xe.Algorithm = XCrypt.XCryptEngine.AlgorithmType.DES;

        //Console.WriteLine(xe.Decrypt(simpletext, keys));
        simpletext = simpletext.Replace(" ", "+");
        string cipertext = xe.Decrypt(simpletext, keys);
        if (cipertext != null)
            return (cipertext);
        else
            return null;
    }
    catch (Exception ex)
    {
        throw ex;
    }
}
#endregion

XCrypt, .

using XCrypt;
-3

All Articles