Skip to content

Instantly share code, notes, and snippets.

@mangei
Created October 9, 2019 21:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save mangei/e70a243236cdd0a53565f76f66c2e065 to your computer and use it in GitHub Desktop.
Save mangei/e70a243236cdd0a53565f76f66c2e065 to your computer and use it in GitHub Desktop.
BCryptPasswordEncoder
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import java.util.Scanner;
public class BCryptPasswordEncoderRun {
public static void main(String[] args) {
System.out.println("Generate BCrypt encoded string of a raw password.");
System.out.println("Enter raw password:");
Scanner s = new Scanner(System.in);
String rawPassword = s.nextLine();
String encodedPassword = new BCryptPasswordEncoder().encode(rawPassword);
System.out.println("Encoded password:");
System.out.println(encodedPassword);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment