md5加密

 

 1     public static String encode(String str)
 2     {
 3         String code=null;
 4         try {
 5             MessageDigest digest=MessageDigest.getInstance("MD5");
 6             code = new String(digest.digest(str.getBytes()));
 7             System.out.println(code);
 8         } catch (NoSuchAlgorithmException e) {
 9             e.printStackTrace();
10         }
11         return code;
12     }

 

posted on 2014-05-28 22:12  wf110  阅读(335)  评论(0编辑  收藏  举报