用于使用java加密和解密密码的API和算法 [英] What API and algorithm to be used to encrypt and decrypt a password using java
本文介绍了用于使用java加密和解密密码的API和算法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
解决方案
已更新 / p>
尝试JBCrypt:
String password =MyPassword123;
String hashed = BCrypt.hashpw(password,BCrypt.gensalt(12));
System.out.println(hash); // $ 2a $ 12 $ QBx3 / kI1SAfwBDFOJK1xNOXK8R2yC7vt2yeIYusaqOisYbxTNFiMy
下载jBCrypt-0.3 ,请查阅README文件了解更多详情。
I am currently creating application using Java, I googled password encryption with java but the results are so enormous I felt overwhelmed. How would I encrypt and decrypt a password using Java? And what is the best practice for encrypting and decrypting passwords? I am guessing MD5 is not a way to go since it is a one way hash. I am using struts2 as my framework, was wondering if they provide password encryption
解决方案
Updated:
Try JBCrypt:
String password = "MyPassword123";
String hashed = BCrypt.hashpw(password, BCrypt.gensalt(12));
System.out.println(hashed); // $2a$12$QBx3/kI1SAfwBDFOJK1xNOXK8R2yC7vt2yeIYusaqOisYbxTNFiMy
Download jBCrypt-0.3 from here, check README file for more details.
这篇关于用于使用java加密和解密密码的API和算法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文