Click here to Skip to main content
13,048,846 members (69,205 online)
Click here to Skip to main content
Add your own
alternative version

Tagged as

Stats

3.4K views
3 bookmarked
Posted 7 May 2011

Password Storage: How to do it.

, 7 May 2011
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

You may also be interested in...

Comments and Discussions

 
Generalit will show error as operator += cannot be applied to byte[... Pin
nilu1613-May-11 8:59
membernilu1613-May-11 8: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.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.170713.1 | Last Updated 8 May 2011
Article Copyright 2011 by zQuangHoangz
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid