I need to import a bunch of user accounts Moodle into a system written in c#.
Moodle uses password_hash() function to create hashes of passwords. I need to be able to verify these passwords in c#.
In other words I looking for a c# implementation of PHP's password verify function ( http://www.php.net/manual/en/function.password-verify.php ).
I've googled a bit but couldn't really find anything close, so I am asking in hopes of avoiding reinventing the wheel :-)
Thanks!
Got it!
First install CryptSharp via NuGet Package. (Use the 2.0 "official" package), and by the way, BCrypt.net didn't work for me.
Then:
using CryptSharp;
bool matches = Crypter.CheckPassword("password goes here", "hash goes here");
Note that hash should start with something like: "$2y$..."
Works like a charm! :-)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With