package com.che.util; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; /** * 加密模块 * @author admin * */ public class PassWDUtil { /** * 对字符串进行 MD5 加密 * @param plainString 需要加密的字符串 * @return 返回加密后的字符串 * @throws NoSuchAlgorithmException */ public static String MD5(String plainString){ if(plainString == null) throw new NullPointerException(); StringBuffer hexString = new StringBuffer(); try { MessageDigest messageDigest = MessageDigest.getInstance("MD5"); messageDigest.update(plainString.getBytes()); byte[] byteData = messageDigest.digest(); for (int i = 0; i < byteData.length; i++) { String hex = Integer.toHexString(0xff & byteData[i]); if (hex.length() == 1) hexString.append('0'); hexString.append(hex); } } catch (NoSuchAlgorithmException e) { e.printStackTrace(); } return hexString.toString(); } }
最近下载更多
阿木林 LV8
2021年6月10日
1255958892 LV2
2021年5月7日
zhujunnan LV12
2021年1月6日
zxx886 LV2
2020年8月26日
a1677596408 LV23
2020年5月14日
liuwenlong LV20
2020年4月21日
我要赚钱 LV6
2019年11月26日
zhangj391391 LV2
2019年11月20日
553152469 LV3
2019年11月15日
keith00 LV12
2019年8月26日