【发布时间】:2014-07-12 07:08:22
【问题描述】:
请告诉我等效的解密代码。我已经使用这种编码方法加密了我的密码,现在我想解密。
MessageDigest digest = MessageDigest.getInstance("MD5");
digest.update(password.getBytes());
BASE64Encoder encoder = new BASE64Encoder();
byte hashedBytes[] = (new String(digest.digest(), "UTF-8")).getBytes();
System.out.println(encoder.encode(hashedBytes))
【问题讨论】:
-
这是How to decrypt SHA-256 encrypted String?的复制品,散列函数的区别并不重要。另外,请阅读Difference between Hashing a Password and Encrypting it
-
你应该阅读How to securely hash passwords?。它解释了为什么您不需要解密来验证密码以及为什么 MD5 甚至 SHA-2 是密码散列的错误选择。
标签: java security encryption passwords decode