码迷,mamicode.com
首页 > 其他好文 > 详细

对字符串md5加密

时间:2018-04-09 18:44:22      阅读:133      评论:0      收藏:0      [点我收藏+]

标签:cas   return   ace   try   dig   tst   一个   bytes   tac   

public String getMD5(String str) {

try {
// 生成一个MD5加密计算摘要
MessageDigest md = MessageDigest.getInstance("MD5");
// 计算md5函数
md.update(str.getBytes());
return new BigInteger(1, md.digest()).toString(16).toUpperCase();

} catch (Exception e) {
e.printStackTrace();
return null;
}
}

对字符串md5加密

标签:cas   return   ace   try   dig   tst   一个   bytes   tac   

原文地址:https://www.cnblogs.com/spps/p/8761343.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!