Md5加密

  public static void main(String[] args) throws Exception
{
MessageDigest md5 = MessageDigest.getInstance("MD5");
String password = "wodemima";
byte[] bytes = md5.digest(password.getBytes());
String result = "";
for(byte b : bytes)
{
String temp = Integer.toHexString(b & 0xff);
if(temp.length() == 1)
{
temp = "0" + temp;
}
result = result + temp;
}
System.out.println(result);
}
  //输出显示:fb2744d1e419813ade40ef0a97c5261f

posted @ 2018-05-15 16:30  最好的年纪最好的自己  阅读(152)  评论(0编辑  收藏  举报