bcrypt icon indicating copy to clipboard operation
bcrypt copied to clipboard

Unify API Bcrypt.with() to be able to hash and verify from the same entrypoint

Open patrickfav opened this issue 6 years ago • 2 comments

See discussion in #23

Talking about it, I think the interface of the lib a bit surprising. Why BCrypt.with()... is for hashing, and BCrypt.verifyer()... is for verifying? It would really make more sense, from an external point of view, if we could simply do: BCrypt.with(LongPasswordStrategies.truncate()).verify(pw, hash);

patrickfav avatar Oct 20 '19 10:10 patrickfav

I like consistent API 😄

Note that you can keep retro-compatibility by keeping the BCrypt.verifyer() as only a wrapper around BCrypt.with() (and marking it as obsolete, if possible in Java?).

Indigo744 avatar Oct 20 '19 10:10 Indigo744

You are right, we can make it backward compatible. And of course I agree with you, a API should be consistent :)

patrickfav avatar Oct 20 '19 10:10 patrickfav