Click here to Skip to main content
15,887,175 members
Home / Discussions / C#
   

C#

 
GeneralRe: Comparing hashed Passwords Pin
Kevin Marois22-Jun-18 7:45
professionalKevin Marois22-Jun-18 7:45 
GeneralRe: Comparing hashed Passwords Pin
#realJSOP22-Jun-18 6:54
mve#realJSOP22-Jun-18 6:54 
AnswerRe: Comparing hashed Passwords Pin
OriginalGriff21-Jun-18 18:30
mveOriginalGriff21-Jun-18 18:30 
GeneralRe: Comparing hashed Passwords Pin
Richard Deeming21-Jun-18 23:54
mveRichard Deeming21-Jun-18 23:54 
AnswerRe: Comparing hashed Passwords Pin
Richard Deeming22-Jun-18 0:04
mveRichard Deeming22-Jun-18 0:04 
GeneralRe: Comparing hashed Passwords Pin
Kevin Marois22-Jun-18 5:59
professionalKevin Marois22-Jun-18 5:59 
GeneralRe: Comparing hashed Passwords Pin
Richard Deeming22-Jun-18 6:51
mveRichard Deeming22-Jun-18 6:51 
GeneralRe: Comparing hashed Passwords Pin
Kevin Marois22-Jun-18 7:55
professionalKevin Marois22-Jun-18 7:55 
OK, so I went back and looked at my Has code, and I figured out why it's not working.

The CompareHashedString method takes a hashed password and a plain text string to compare it to.

So that means I would have to pass the user's keyed in password in PLAIN TEXT to the back end, where this code lives.

Here's the Compare method again.
public static bool CompareHashedString(string hashedPWDFromDB, string passwordFromUser)
{
    bool isValid = true;

    byte[] salt = new byte[16];

    byte[] hashBytes = Convert.FromBase64String(hashedPWDFromDB);

    Array.Copy(hashBytes, 0, salt, 0, 16);

    var pbdkdf2 = new Rfc2898DeriveBytes(passwordFromUser, salt, 10000); // Hash the passwordFromUser

    byte[] hash = pbdkdf2.GetBytes(20);

    for (int i = 0; i < 20; i++)
    {
        if (hashBytes[i + 16] != hash[i])
        {
            isValid = false;
            break;
        }
    }

    return isValid;
}
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.

QuestionC# web browser example Pin
tsi clinero21-Jun-18 12:06
tsi clinero21-Jun-18 12:06 
AnswerRe: C# web browser example Pin
User 418025421-Jun-18 13:02
User 418025421-Jun-18 13:02 
GeneralRe: C# web browser example Pin
tsi clinero21-Jun-18 13:11
tsi clinero21-Jun-18 13:11 
Questionbest connection sql server in c# windows application(clinet/server) Pin
Member 1387544620-Jun-18 2:12
Member 1387544620-Jun-18 2:12 
AnswerRe: best connection sql server in c# windows application(clinet/server) Pin
OriginalGriff20-Jun-18 2:25
mveOriginalGriff20-Jun-18 2:25 
AnswerRe: best connection sql server in c# windows application(clinet/server) Pin
Pete O'Hanlon20-Jun-18 3:03
mvePete O'Hanlon20-Jun-18 3:03 
AnswerRe: best connection sql server in c# windows application(clinet/server) Pin
Eddy Vluggen20-Jun-18 7:15
professionalEddy Vluggen20-Jun-18 7:15 
AnswerRe: best connection sql server in c# windows application(clinet/server) Pin
Gerry Schmitz21-Jun-18 8:39
mveGerry Schmitz21-Jun-18 8:39 
GeneralRe: best connection sql server in c# windows application(clinet/server) Pin
Eddy Vluggen22-Jun-18 2:28
professionalEddy Vluggen22-Jun-18 2:28 
QuestionVisual Studio 2017(C#_WinForm), Chameleon3 CM3-U3-13Y3M control question Pin
Member 1387921619-Jun-18 19:39
Member 1387921619-Jun-18 19:39 
AnswerRe: Visual Studio 2017(C#_WinForm), Chameleon3 CM3-U3-13Y3M control question Pin
OriginalGriff19-Jun-18 20:56
mveOriginalGriff19-Jun-18 20:56 
GeneralRe: Visual Studio 2017(C#_WinForm), Chameleon3 CM3-U3-13Y3M control question Pin
Member 1387921619-Jun-18 21:14
Member 1387921619-Jun-18 21:14 
GeneralRe: Visual Studio 2017(C#_WinForm), Chameleon3 CM3-U3-13Y3M control question Pin
OriginalGriff19-Jun-18 21:24
mveOriginalGriff19-Jun-18 21:24 
AnswerRe: Visual Studio 2017(C#_WinForm), Chameleon3 CM3-U3-13Y3M control question Pin
Dave Kreskowiak20-Jun-18 4:27
mveDave Kreskowiak20-Jun-18 4:27 
GeneralRe: Visual Studio 2017(C#_WinForm), Chameleon3 CM3-U3-13Y3M control question Pin
Member 1387921620-Jun-18 16:59
Member 1387921620-Jun-18 16:59 
QuestionC# - Convert Pixels ( X & Y ) points to Longitude and Latitude Pin
Member 1384510217-Jun-18 18:18
Member 1384510217-Jun-18 18:18 
AnswerRe: C# - Convert Pixels ( X & Y ) points to Longitude and Latitude Pin
V.17-Jun-18 18:34
professionalV.17-Jun-18 18:34 

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.