0
A
回答
0
自己的例子,創建一個實用工具類散列,使用這樣的靜態方法...
public class MD5Util {
private static final String ALGORITHM = "MD5";
public static String getHash(String text){
try {
MessageDigest md = MessageDigest.getInstance(ALGORITHM);
md.update(text.getBytes());
byte[] byteData = md.digest();
StringBuffer hexString = new StringBuffer();
for(byte bd : byteData){
String hex = Integer.toHexString(bd & 0xff);
if(hex.length() == 1)
hexString.append(0);
hexString.append(hex);
}
return hexString.toString();
} catch (NoSuchAlgorithmException ex) {
Logger.getLogger(MD5Util.class.getName()).log(Level.SEVERE, null, ex);
}
return null;
}
}
然後,調用靜態方法和結果集到標籤字段,像這樣...
hashValueLabel.setText(MD5Util.getHash(textInputLabel.getText()));
相關問題
- 1. 無法從Java md5哈希得到相同的結果作爲python md5哈希
- 2. Java MD5哈希不匹配.NET哈希
- 3. 有不同的結果MD5哈希
- 4. 在彈出窗口中顯示結果
- 5. MD5哈希函數輸出垃圾
- 6. SQL 2005 MD5哈希和C#MD5哈希
- 7. C#MD5哈希Groovy的MD5哈希
- 8. PHP MD5(MD5)哈希
- 9. Java計算MD5哈希
- 10. JavaScript MD5哈希與Java Applet MD5散列?
- 11. PHP MD5哈希
- 12. JQueryMobile彈出窗口不顯示時,將哈希追加到URL
- 13. MD5哈希更快
- 14. 如何在Qt中創建MD5哈希?
- 15. 解密MD5哈希
- 16. SHA512和MD5哈希
- 17. 生成MD5哈希
- 18. GPU MD5/SHA1哈希
- 19. 如何將結果輸出到JSFiddle中的'結果'窗口?
- 20. MD5哈希在Python中返回不同的結果
- 21. MD5哈希在藥劑
- 22. 結合多個文件的MD5哈希
- 23. 結果顯示在新窗口中
- 24. MD5哈希關於java而非JavaScript
- 25. 使用Java處理MD5哈希問題
- 26. .net和java的不同MD5哈希值
- 27. Java MD5哈希,我該怎麼辦?
- 28. Console.WriteLine不顯示在輸出窗口
- 29. OutputDebugString - 不在輸出窗口中顯示
- 30. BSD unix md5哈希位值
https://s32.postimg.org/eb609f0dh/hasher1.png – BigDonnie123