

0 / 2 embers
0 / 3000 xp
click for more info
Complete a lesson to start your streak
click for more info
Still calibrating
click for more info
Not enough gems
Cost: 6 gems
1: Encrypting Data at Rest
incomplete
2: Key Management and Rotation
incomplete
3: Password KDFs
incomplete
4: Salts
incomplete
5: Argon2 Parameters
incomplete
6: Encrypted Files
incomplete
7: Secure Database Practices
incomplete
8: Personally Identifiable Information
incomplete
9: Financial Data
incomplete
Back
ctrl+,
Next
ctrl+.
This lesson's interactive features are locked, please to keep using them
Two people should be allowed to choose the same password, but they should not end up with the same stored hash.
Without a salt, identical passwords produce identical hashes. A database leak would reveal which accounts share a password and let an attacker reuse the same precomputed guesses against every matching row.
A salt is random data mixed into one password-hashing operation. It doesn't need to be secret, but it must be unique and unpredictable.
Go's low-level Argon2 package doesn't generate or encode salts for the application. Bearly Secure generates a fresh salt with crypto/rand and stores it inside the encoded Argon2id string:
$argon2id$v=19$m=19456,t=2,p=1$<salt>$<hash>
That string contains everything verification needs:
Don't keep one shared salt, treat salts as secrets, or concatenate an ad hoc value into the password. Generate a fresh salt for every hash and keep it with that hash in one well-defined format.