把密码经过md5后,是一串字符串,那么就无法反过去得到原始的

密码了。

Java Apache 


呵呵,在网上查了看了很多,综合起来整理一个,先记下来以后用到了,直接来取。


 

1.    /**
2.      * MD5 加密
3.      */
4. private
5. null;  
6.   
7. try
8. "MD5");  
9.   
10.             messageDigest.reset();  
11.   
12. "UTF-8"));  
13. catch
14. "NoSuchAlgorithmException caught!");  
15. 1);  
16. catch
17.             e.printStackTrace();  
18.         }  
19.   
20. byte[] byteArray = messageDigest.digest();  
21.   
22. new
23.   
24. for (int i = 0; i < byteArray.length; i++) {              
25. if (Integer.toHexString(0xFF & byteArray[i]).length() == 1)  
26. "0").append(Integer.toHexString(0xFF
27. else
28. 0xFF
29.         }  
30.   
31. return
32.     }