I'm looking to allow bcrypt support in my authentication library. One of the problems right now is that I assume that the hasher will be of type HashAlgorithm
. Bcrypt.net does not implement this class. Also, it's sealed so I would have to make my own branch off of it and modify it myself. Are there any better alternatives that already implement HashAlgorithm?
相关问题
- Generic Generics in Managed C++
- How to Debug/Register a Permanent WMI Event Which
- facebook error invalid key hash for some devices
- 'System.Threading.ThreadAbortException' in
- Bulk update SQL Server C#
Try this:
Usage:
Also, I added a helper Verify method so you can verify that the password and hash match, but you can eliminate this if you just call the default BCrypt.Verify.
I added some extra properties so you can pass in a pre-computed salt or a work factor to generate a new salt before you do the hash:
I tried it with the BCrypt test case "abc" with a salt of "$2a$06$If6bvum7DFjUnE9p2uDeDu" and got the correct hash.