tallesl/net-Hash

Hash check not working

LeonM82 opened this issue · 1 comments

Hi

I am trying to use your libary for password hashing and checking but always get a false from the Check function.
Looking at the code you don't seem to check the newly created HashedPassword to the old one.

Regards
Leon

The library seems to be working fine... do you have something reproducible so I can check it out?
Are you sure you're not messing the encoding of your strings before handling it to the library?

I just ran the code below and it went fine:

using HashLibrary;
using System;

class Program
{
    static void Main(string[] args)
    {
        var hasher = new Hasher();
        var hashedPassword = hasher.HashPassword("foo");

        var check = hasher.Check("foo", hashedPassword);
        Console.WriteLine(check); // prints "True"

        check = hasher.Check("bar", hashedPassword);
        Console.WriteLine(check); // prints "False"
    }
}