I'm creating an application where I'm going to use Argon2, I'm going to have a password, and I'm going to use as salt: email+name+date of birth, you must think that my salt is silly because name and date of birth can change, which would change the result, well this is not the case with my application, I should and will use these 3 pieces of information for the salt anyway, but what do you think is safer? Argon2(password, email+name+birth date) or Argon2(password, email+name+birth date+password), another thing, what format should I pass the salt? Hexadecimal?
2$\begingroup$ I'd say the only time you'd have a salt like that is if you're making a deterministic password manager. Otherwise, random is the way to go, as suggested. I agree there's no value in using the password for both inputs; if you want something secret, a random salt should be kept secret. $\endgroup$– samuel-lucas6Dec 9, 2022 at 12:26
Argon2(password, email+name+birth date) or Argon2(password, email+name+birth date+password) ?
There is no notable difference in security, thus keep it simple. What matters most to security are (somewhat in decreasing order)
- The integrity of the execution environment (if the inputs including password can be monitored, forget about security)
- The quality of the password (
123456can't be made safe). Calling it a passphrase in user interactions (as in PGP) is cheap, and I believe helps more often than not.
- parameters for the workfactor (if in doubt, for password use, see recommendations)
- $t$ (controlling number of passes)
- $m$ (controlling memory size)
- $p$ (controlling degree of parallelism)
- the uniqueness (and to some degree unpredictability) of the salt
- the secrecy of $K$ (secret value aka pepper) if used
- the Argon2 variant if side channels are an issue (Argon2id should be fine in practice).
I'm going to use as salt: email+name+date of birth
Beware that name and date of birth are often considered confidential (as well as email sometime), and unless they are supplied at each use they will need to be stored. The standard thing is a random salt, and some libraries packaging Argon2 for generation and verification of password tokens won't allow another option.
What format should I pass the salt? Hexadecimal?
Salt/nonce $S$ is defined as a bytestring in Argon2, thus I see no point in doubling the size by going hex unless the library used to access Argon2 has some limitation. Again, some libraries handle the salt, and store it into the password token (typically with some text encoding).