VerifyHashedPassword always returns a Failed result

We make it to the switch statement and it goes right to the default case since the decoded password doesn't match any of the cases. Any suggestionts for what I should do about this?
No description
No description
9 Replies
Angius
Angius2w ago
Well, seems like the first byte is neither 0 nor 1 Any reason you even use base64 there in the first place?
clownshark5503
clownshark5503OP2w ago
It gets upset if base64 isn't used In case its not clear and I dont realize that: VerifyHashedPassword is from a aspnetcore identity, I don't really have a say modifying this.
Angius
Angius2w ago
Aaaah, that makes more sense
Pascal
Pascal2w ago
You need to ensure that the expected format marker is set when generating the Hash. How are you generating the Hash?
Unknown User
Unknown User2w ago
Message Not Public
Sign In & Join Server To View
MODiX
MODiX2w ago
If you have no further questions, please use /close to mark the forum thread as answered
clownshark5503
clownshark5503OP2w ago
I was using ToBase64String
Jimmacle
Jimmacle2w ago
with what, plain credentials? you need to use APIs in the identity library to set the password, that will hash it correctly if you're using identity you shouldn't be doing any kind of password hashing yourself because it's all built into that library (and ToBase64String would be a very insecure and wrong way to hash a password, it's not even a hash) iirc the most recent algorithm identity uses to hash passwords is PBKDF2-HMAC-SHA256 and it also salts it with some random bytes but that isn't something you need to know if you're using a premade auth solution like identity
Pascal
Pascal2w ago
this is definitely the problem. you should be using string HashPassword(TUser user, string password) method on the IPasswordHasher<TUser> implementation.
Want results from more Discord servers?
Add your server