Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider supporting a pepper #4

Open
tjconcept opened this issue Dec 13, 2015 · 2 comments
Open

Consider supporting a pepper #4

tjconcept opened this issue Dec 13, 2015 · 2 comments

Comments

@tjconcept
Copy link
Member

http://security.stackexchange.com/questions/3272/password-hashing-add-salt-pepper-or-is-salt-enough

Test the impact on hashing performance.

@Sc00bz
Copy link

Sc00bz commented Oct 11, 2018

Pepper is actually a "non-cryptographic salt" (e.g. username), but recently (2012-2013) has been stolen to mean a server secret (i.e. key). Note that most say to use a "pepper" as some kind of keyed hash. This is wrong. You should always use this key to deterministically encrypt the hash part. NULL-IV-CBC-CTS is ideal. Yes this will make cryptographers shit their pants until they realize that you are encrypting cryptographic random data. They might still have issues because this is non-standard but there are no attacks... if you encrypt binary data and not ASCII encoded data. This also lets you use an HSM to just encrypt and then you compare the output. Also if the hashes are stolen you can re-encrypt your hashes under a new key to make the stolen hashes worthless. Unlike with keyed hashing, which need to be rehashed on login, password reset, or password change.

I've been meaning to finish a blog post about this and that new API functions for password authentication should be like:

string hash(string password, [function encryptHash, ["params" encryptHashParams]])
bool verify(string password, string hash, [function encryptHash, ["params" encryptHashParams]])
blob encryptHash(blob hashPart, int maxOutputLength, "params" encryptHashParams)

Anyway switching to bcrypt is 1000x better... really 40x better. Well Node's PBKDF2-SHA512 is compiled vs bcrypt which will be interpreted JS. So only 4x? better.

@tjconcept
Copy link
Member Author

This is wrong

Can you elaborate on this?

just encrypt and then you compare the output

If the output of the encryption is deterministic, what is the difference from hashing? I suppose an attacker would brute force against the pepper in both situations?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants