Click here to Skip to main content
14,358,781 members

Password Storage: How to do it.

Rate this:
5.00 (1 vote)
Please Sign up or sign in to vote.
5.00 (1 vote)
8 May 2011CPOL
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.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

zQuangHoangz
Vietnam Vietnam
No Biography provided

Comments and Discussions

 
Generalit will show error as operator += cannot be applied to byte[... Pin
nilu1613-May-11 9:59
membernilu1613-May-11 9:59 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Alternative
Tip/Trick
Posted 8 May 2011

Tagged as

Stats

5.4K views
3 bookmarked