java的md5加密实现代码

n24d的头像 n24d 10 2015-01-04 17:17 2

 基本信息

× 1   

浏览数: 4418

分享时间: 4 年 前

4
import java.security.MessageDigest;  
import java.security.NoSuchAlgorithmException;  
  
public class Md5Code {  
  
    public String Md5(String plainText)  
    {  
        System.out.println("加密前:"+plainText);  
        try {  
            MessageDigest md = MessageDigest.getInstance("MD5");  
            md.update(plainText.getBytes());  
            byte[] b = md.digest();  
              
            int i;  
            StringBuffer buf = new StringBuffer("");  
            for (int offset = 0; offset < b.length; offset++)   
            {  
                i = b[offset];  
                if (i<0) i+=256;  
                if(i<16)  
                buf.append("0");  
                buf.append(Integer.toHexString(i));  
                      
            }  
              
            System.out.println("加密后:"+buf.toString());  
            return buf.toString();  
        } catch (NoSuchAlgorithmException e) {  
            // TODO Auto-generated catch block  
            e.printStackTrace();  
        }  
        return plainText;  
    }  
      
      
}  


12 3 [下一页]

  • ossaa的头像 ossaa 2018-06-22 04:27 代码数:0

    You know your projects stand out of the herd. There is something special about them. It seems to me all of them are really brilliant!

    3 day military diet

  • ossaa的头像 ossaa 2018-12-19 04:46 代码数:0

    Thank you for helping people get the information they need. Great stuff as usual. Keep up the great work!!!

    car paint protection

  • ossaa的头像 ossaa 2018-06-24 16:01 代码数:0

    Awesome blog. I enjoyed reading your articles. This is truly a great read for me. I have bookmarked it and I am looking forward to reading new articles. Keep up the good work!

    Lebensversicherung optimieren

  • ossaa的头像 ossaa 2018-06-25 19:09 代码数:0

    Impressive web site, Distinguished feedback that I can tackle. I am moving forward and may apply to my current job as a  pet sitter, which is very enjoyable, but I need to additional  expand. Regards.

    Tech Learning Center

  • jhoneila的头像 jhoneila 2018-12-22 14:55 代码数:0

    This type of message always inspiring and I prefer to read quality content, so happy to find good place to many here in the post, the writing is just great, thanks for the post. Training Bat for Softball

  • jhoneila的头像 jhoneila 2018-12-22 15:32 代码数:0

    I am happy to find your distinguished way of writing the post. Now you make it easy for me to understand and implement the concept. Thank you for the post. First Aid Classes Bend Oregon

  • ossaa的头像 ossaa 2018-06-26 21:25 代码数:0

    I just found this blog and have high hopes for it to continue. Keep up the great work, its hard to find good ones. I have added to my favorites. Thank You.

    acim

  • ossaa的头像 ossaa 2018-12-26 21:55 代码数:0

    Thanks for the nice blog. It was very useful for me. I'm happy I found this blog. Thank you for sharing with us,I too always learn something new from your post.

    mais vendidos

  • ossaa的头像 ossaa 2019-01-01 22:07 代码数:0

    it was a wonderful chance to visit this kind of site and I am happy to know. thank you so much for giving us a chance to have this opportunity..

    Anabole steroide kaufen

  • ossaa的头像 ossaa 2019-01-08 15:25 代码数:0

    Awesome blog. I enjoyed reading your articles. This is truly a great read for me. I have bookmarked it and I am looking forward to reading new articles. Keep up the good work!

    vipbox

您的评论: