I’m working on my sites authentication and was thinking of using bcrypt and randomly creating a salt thats stored in my users login row on the database. I want my site to be fast but anything over using 15 to generate(takes about 1 second) is too slow so I was thinking of randomly generating a salt between say 5-14, but is that secure or is there a better way?
If it helps, I’m using py-bcrypt.
One major reason to use bcrypt is to prevent brute force attacks by requiring a lot of CPU time to calculate hashes. For your problem I would use a constant length salt, but with random values, this way each password takes the same amount of time to calculate.
From this you can cater your length of salt and number of stretching iterations to whatever you feel is secure enough, though I personally like to make sure the hash takes at least 1/2 second to generate on a really beefy server.