paulmillr / noble-hashes

Audited & minimal JS implementation of hash functions, MACs and KDFs.
https://paulmillr.com/noble
MIT License
528 stars 40 forks source link

Usage for storing and comparing passwords #87

Closed aurelius-coffee closed 2 months ago

aurelius-coffee commented 2 months ago

Hi,

I came here following this guide https://lucia-auth.com/tutorials/username-and-password/astro .

How would one go about using this library for storing and comparing passwords?

Thanks

paulmillr commented 2 months ago

use argon2id(password) or scrypt(password) to generate keys based on passwords. Then, simply compare keys with each other

aurelius-coffee commented 2 months ago

and I imagine store the randomly-generated salt alongside the hash in the db and then use it to compare?

paulmillr commented 2 months ago

yeah, salt helps