Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save miklobit/0a57ad91e761c957f5c3757d047e8f18 to your computer and use it in GitHub Desktop.
Save miklobit/0a57ad91e761c957f5c3757d047e8f18 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