💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
~~~ 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(); } ~~~