企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
~~~ public String MD5(String string) { MessageDigest md5 = null; try { md5 = MessageDigest.getInstance("MD5"); } catch (NoSuchAlgorithmException e) { e.printStackTrace(); } md5.update(string.getBytes()); byte[] bytes = md5.digest(); StringBuffer stringBuffer = new StringBuffer(); for (int i = 0; i < bytes.length; i++) { if (Integer.toHexString(0xff & bytes[i]).length() == 1) { stringBuffer.append('0').append(Integer.toHexString(0xff & bytes[i])); } else { stringBuffer.append(Integer.toHexString(0xff & bytes[i])); } } return stringBuffer.toString(); } ~~~