Created
October 1, 2015 12:55
-
-
Save Voronenko/d50fc04cbbf26dfed37d to your computer and use it in GitHub Desktop.
Algorithm that generates password hash for jenkins user from plain text password
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.security.NoSuchAlgorithmException; | |
public class BcryptHashPassword | |
{ | |
public static void main(String[] args) throws NoSuchAlgorithmException | |
{ | |
String originalPassword = "secretpasswd"; | |
String generatedSecuredPasswordHash = BCrypt.hashpw(originalPassword, BCrypt.gensalt(10)); | |
System.out.println(generatedSecuredPasswordHash); | |
boolean matched = BCrypt.checkpw(originalPassword, generatedSecuredPasswordHash); | |
System.out.println(matched); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment