Click here to Skip to main content
Click here to Skip to main content
Alternative Tip/Trick

Tagged as

Password Storage: How to do it.

, 8 May 2011 CPOL
Rate this:
Please Sign up or sign in to vote.
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[... Pinmembernilu1613-May-11 9:59 

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

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

| Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.141223.1 | Last Updated 8 May 2011
Article Copyright 2011 by zQuangHoangz
Everything else Copyright © CodeProject, 1999-2014
Layout: fixed | fluid