65.9K
CodeProject is changing. Read more.
Home

Password Storage: How to do it.

starIconstarIconstarIconstarIconstarIcon

5.00/5 (1 vote)

May 8, 2011

CPOL
viewsIcon

7012

I think it has error, for example:A user is:string userId = "OriginalGriff"; string password = "NotMyPassword";And other user is:string userId = "Original"; string password = "GriffNotMyPassword";Problem to store two user.My idea is:private static...

I think it has error, for example: A user is:
string userId = "OriginalGriff";
            string password = "NotMyPassword";
And other user is:
string userId = "Original";
            string password = "GriffNotMyPassword";
Problem to store two user. My idea is:
private static byte[] GetSHA1(string userID, string password)
            {
            SHA1CryptoServiceProvider sha = new SHA1CryptoServiceProvider();
            byte[] hashedPassword = sha.ComputeHash(System.Text.Encoding.ASCII.GetBytes(userID);
            hashedPassword += sha.ComputeHash(System.Text.Encoding.ASCII.GetBytes(password);
            return sha.ComputeHash(hashedPassword);
            }
Thanks.