Click here to Skip to main content
15,891,136 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Good Day All, I have this little issue About using bcrypt to verify password ..
C#
// Below is my code
string mypas = "MyPass";
                         string mysalt = BCrypt.Net.BCrypt.GenerateSalt();
                         string myharsh = BCrypt.Net.BCrypt.HashPassword(mypas, mysalt);

// and i save to the database... then to verify the pass word 
my password = "MyPass";
//db.password is the harshed password stored on the database
bool validate = BCrypt.Net.BCrypt.Verify(mypas, db.Password);
            if(validate == true)
            {
                MyClass.MyAlert(this, "Correct Password Entered", "123");
                    return;
            }
            else
            {
                MyClass.MyAlert(this, "Incorrect password", "123");
                return;
            }
I have about 10 harshed password on my database... But when ever i verify all  the passwords, only one will work.. The first password i entered into the database.. the rest will not work.. Am i missing something?
Thanks, I really do appreciate your help..
Posted
Comments
Shaun Blain 13-Jan-15 15:27pm    
Did something change in your code from the time the first entry was made and the rest of the entries in the database? From looking over your code above it appears that you are calling the class correctly.

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900