Skip to content

Instantly share code, notes, and snippets.

@Voronenko
Created October 1, 2015 12:55
Show Gist options
  • Save Voronenko/d50fc04cbbf26dfed37d to your computer and use it in GitHub Desktop.
Save Voronenko/d50fc04cbbf26dfed37d to your computer and use it in GitHub Desktop.
Algorithm that generates password hash for jenkins user from plain text password
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