sky

風雨过後不一定有美好的天空 不是天晴就會有彩虹

原创 md5加密算法收藏

    public  static String encrypt_md5(String srcStr)
    {
      String hexStr="0123456789abcdef";
      String result="";
      try
      {
        java.security.MessageDigest md5=java.security.MessageDigest.getInstance("MD5");
        md5.update(srcStr.getBytes());
        byte bytes[]=md5.digest();
        for(int i=0;i<bytes.length;i++)
        {
          int temp=bytes[i]<0?bytes[i]+256:bytes[i];
          result=result+hexStr.charAt((temp/16)%16)+hexStr.charAt(temp%16);
        }
      }
      catch(Exception e)
      {
        System.out.println(e.getMessage());
        e.printStackTrace();
      }
      return result;
 
  }   

发表于 @ 2005年01月18日 10:18:00|评论(loading...)

新一篇: 远走高飞 | 旧一篇: 渐渐

Csdn Blog version 3.1a
Copyright © jing