public static String md5(String text) { byte[] bytes = null; try { bytes = MessageDigest.getInstance("md5").digest( text.getBytes()); } catch (NoSuchAlgorithmException e) { throw new RuntimeException("没有md5这个算法!"); } String md5code = new BigInteger(1, bytes).toString(16); for (int i = 0; i < 32 - md5code.length(); i++) { md5code = "0" + md5code; } return md5code; }
MD5加密算法(基于JAVA)
最新推荐文章于 2024-08-29 16:57:08 发布