其他分享
首页 > 其他分享> > SpringSecurity-BCrypt加密

SpringSecurity-BCrypt加密

作者:互联网

public static void main(String[] args) {
		// 1.创建BCryptPasswordEncoder对象
		BCryptPasswordEncoder passwordEncoder = new BCryptPasswordEncoder();
		
		// 2.准备明文字符串
		String rawPassword = "123456";
		
		// 3.加密
		String encode = passwordEncoder.encode(rawPassword);
		System.out.println(encode);
		
		// 4.比较
		boolean matchResult = passwordEncoder.matches(rawPassword, encode);
		
		System.out.println(matchResult);
	}

标签:rawPassword,加密,String,BCryptPasswordEncoder,System,passwordEncoder,SpringSecurit
来源: https://blog.csdn.net/IT_world_/article/details/122012158