![在这里插入图片描述](https://img-blog.csdnimg.cn/20210704145510114.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dlaXhpbl80ODI0Nzg4MQ==,size_16,color_FFFFFF,t_70
推荐使用spring的盐值加密技术
@Test
void contextLoads() {
//加密
BCryptPasswordEncoder bCryptPasswordEncoder = new BCryptPasswordEncoder();
String encode = bCryptPasswordEncoder.encode("123456");
System.out.println(encode);//结构$2a$10$FhzPKCa2kDqMKbZfbQywCOHX3.hXRbwTYh80qZh5F04HQNfX2vgTW
//解密
boolean matches = bCryptPasswordEncoder.matches("123456", "$2a$10$FhzPKCa2kDqMKbZfbQywCOHX3.hXRbwTYh80qZh5F04HQNfX2vgTW");
System.out.println(matches);
}