[英]Hashing passwords in Java servlet
I earlier found this answer regarding hashing passwords in Java, but I'm using Java 7 while the answer works only in Java 8. I tried to adapt it without success, so... Any suggestions?我刚才发现这个关于Java的散列密码的答案,但我使用的Java 7,而答案只能用Java 8.我尝试没有成功,去适应它,所以......有什么建议? I also downloaded the bouncycastle library, but I don't understand how it works...我也下载了 bouncycastle 库,但我不明白它是如何工作的...
Thank you for your time感谢您的时间
I would suggest using Jasypt it very simple to use.我建议使用Jasypt,它使用起来非常简单。
For example :例如:
private static final String ENC_ALGORITHM = "PBEWithMD5AndDES";
...
StandardPBEStringEncryptor textEncryptor = new StandardPBEStringEncryptor();
textEncryptor.setAlgorithm(ENC_ALGORITHM);
textEncryptor.setPassword("MySuperSecretSeed"); // make sure this is stored somewhere safe like an ENV variable
String encryptedPassword = textEncryptor.encrypt("Password to be encrypted");
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.