3 ms·
Why don't you generate your salt by hand?
by baby 13y ago
Why don't you generate your salt by hand?
- masklinn 13y agoBecause there's very little point in doing so since bcrypt will automatically generate one for you. A use case for manually injecting the salt is when your KDF result isn't stored in Modular Crypt Format, and thus you can't just pass it to `password_verify`. In that case, you get your stored cost and salt, explicitly inject them into `password_hash` and use a constant-time string comparison (which I'm not sure PHP provides, so there's a potential security hole here) instead of `password_verify`.