import org.junit.jupiter.api.Test; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; //BCryptPasswordEncoder 加密 @SpringBootTest public class BCryptTests { BCryptPasswordEncoder passwordEncoder = new BCryptPasswordEncoder(); @Test void encode(){ long l = System.currentTimeMillis();//计时开始 String rawpassword="123456"; System.out.println("原文:"+rawpassword); for (int i=0;i<10;i++) { String aaapassword = passwordEncoder.encode(rawpassword); System.out.println("加密:" + aaapassword); } long end=System.currentTimeMillis(); System.out.println("耗时:"+(end - l)); }
BCryptPasswordEncoder 加密
最新推荐文章于 2024-04-09 15:23:20 发布