md5 对字符串进行加密的方法 简单好用
时间:2014-04-29 10:16:46
收藏:0
阅读:348
1 public static String makeMD5(String password) { 2 String result = null; 3 4 MessageDigest messageDigest; 5 try { 6 messageDigest = MessageDigest.getInstance("MD5"); 7 messageDigest.update(password.getBytes()); 8 result = new BigInteger(1, messageDigest.digest()).toString(16); 9 } catch (Exception e) { 10 e.printStackTrace(); 11 } 12 return result; 13 }
评论(0)