alexedwards / argon2id

Argon2id password hashing and verification for Go
MIT License
452 stars 44 forks source link

CompareHashAndPassword #22

Closed ivanw98 closed 9 months ago

ivanw98 commented 9 months ago

I have a function CreateUser that takes an email and password from the body of the post request and hashes the password using argon2id.CreateHash(requestBody.password, argon2id.DefaultParams) then inserts the email address and hashed password into the database.

I have another function LoginUser that also takes the requestBody.password and uses argon2id.ComparePasswordAndHash(requestBody.password, database.password) However the comparison always returns false and it appears that the hash created changes under different function scopes - how do I get round this issue?