Password Hashing using BCrpyt - jbcrypt.jar

So we have all used authentication for various applications.
Using Bcrypt you can easily use hashing for passwords and other authentication required for your application Implementation simple example.

Maven Dependancy

 <dependency>
        <groupId>org.mindrot</groupId>
        <artifactId>jbcrypt</artifactId>
        <version>0.3m</version>
    </dependency>

1) You can save your data after using the BCrypt method to hash it.
            String  originalPassword = passwd;
            BCrypt.hashpw(originalPassword, BCrypt.gensalt());

2) You match your password entered by the user on login with the hashed password in your DB.
    BCrypt.checkpw(userEnteredPwd, hashedPwdFromDB);


Comments