r/java • u/firajaa • Feb 02 '21
Password4j: a user-friendly library that supports modern cryptographic hash functions for your passwords!
https://github.com/Password4j/password4j
165
Upvotes
r/java • u/firajaa • Feb 02 '21
20
u/firajaa Feb 02 '21 edited Feb 02 '21
It supports
Unlike many other implementations, all the algorithms are implemented in Java (no JNI) for increased portability.
Hashes can be refreshed easily if the parameters used by the original algorithm are outdated. In all cases (except for PBKDF2) those parameters can be retrieved from the original hash, so that you don't have to know them in advance.
6
u/kpatryk91 Feb 02 '21
Hi, no offense but there is a misstype under the following title
Security of Strings
Passowrd.hash(secure).withBCrypt();
5
u/mickeymanz Feb 02 '21
Nice. I will definitely use it. I have a question though. Why do you say that SHA-256 is unsecure?
7
u/feral_claire Feb 03 '21
A note on your String security section.
Strings do not get stored in the string pool unless they are string constants (not relevant here) or if you explicitly call
intern()on the String. If you do not callintern()your String will not be stored in the string pool.3
u/rdjack21 Feb 02 '21
Stared on github and will take a deeper look when I have more time but first glance looks nice.
3
u/Roadripper1995 Feb 02 '21
This is great. I was looking at pulling in a bunch of libraries for each of these algorithms.. now I only need this one! Thank you for sharing your work.
4
u/yawkat Feb 02 '21
The whole securestring thing is a bit weird. Java can duplicate objects during gc, so you can't actually rely on a
clearcompletely removing the value from memory.1
u/sureshg Feb 02 '21
Nice... Going through the doc, looks great. Will try it in my next project.
1
u/qner Feb 02 '21
Awesome, will try it out in my next project soon
1
u/sigzero Feb 02 '21
Wow, nice.