This Java library provides a way for password hashing.
The usage of this library rests on 2 classes.
The first one is the Salt
that returns a random salt.
The second one is Hash
that uses the previously computed salt to process the password hashing.
<dependency>
<groupId>com.github.chrix75</groupId>
<artifactId>password-hashing</artifactId>
<version>0.1.0</version>
</dependency>
Salt salt = new Salt(16);
String encodedSalt = salt.toString();
The toString
method returns the salt value into a base 64 encoded string. It's useful for saving the salt value.
Hash hash = new Hash("PASSWORD", salt);
String encodedPassword = hash.toString();
The toString
method returns the hashed password into a base 64 encoded string.
PasswordChecker checker = new PasswordChecker(encodedPassword, "PASSWORD", encodedSalt);
assertTrue(checker.isCorrect());