From the course: Learn Java Cryptography

Unlock this course with a free trial

Join today to access over 25,500 courses taught by industry experts.

Leveraging Bcrypt with Java

Leveraging Bcrypt with Java - Java Tutorial

From the course: Learn Java Cryptography

Leveraging Bcrypt with Java

- So now that we've generated a hash, and talked about why that hashing algorithm shouldn't be used for passwords, I wanna show you how to actually use BCrypt to hash a password. Now again, this is outside the JCA, but this is very important for Java developers to understand. Now let's jump into our ID and the first thing that we need to do is open up our pom.xml file. We're gonna add a new dependency. And the dependency that we are going to add is jBCrypt, and this comes from the group de.svenkubiak. And we are going to use version 0.4.1. Go ahead and let Maven do its thing, and download that jar. And then we're gonna go ahead and open up our HashUtil, so in src, main, java, com.frankmoley.crypto hash, open up HashUtils. This is actually a super simple algorithm to use, because they've done all the work for you. So it returns a string, so we are going to do a public static string, hashPassword, and we will simply pass in the…

Contents