public static void main(String[] args) { // spring 4.0.0 org.springframework.security.crypto.password.PasswordEnprer enprer = new org.springframework.security.crypto.bcrypt.BCryptPasswordEnprer(); // a$lB6/PKg2/JC4XgdMDXyjs.dLC9jFNAuuNbFkL9udcXe/EBjxSyqxW // true // a$KbQiHKTa1WIsQFTQWQKCiujoTJJB7MCMSaSgG/imVkKRicMPwgN5i // true // aWfW4uxVb4SIdzcTJI9U7eU4ZwaocrvP.2CKkWJkBDKz1dmCh50J2 // true // awR/6uaPxU7kGyUIsx/JS.krbAA9429fwsuCyTlEFJG54HgdR10nK // true // a$gfmnyiTlf8MDmwG7oqKJG.W8rrag8jt6dNW.31ukgr0.quwGujUuO // true for (int i = 0; i < 5; i++) { // "123456" - plain text - user input from user interface String passwd = enprer.enpre("123456"); // passwd - password from database System.out.println(passwd); // print hash // true for all 5 iteration System.out.println(enprer.matches("123456", passwd)); }}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)