package com.qianwen.smartman.modules.dnc.util; import java.nio.charset.StandardCharsets; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; public class StringMd5HashCode { public static String getMd5(String text) throws NoSuchAlgorithmException { MessageDigest md5 = MessageDigest.getInstance("MD5"); byte[] bytes = md5.digest(text.getBytes(StandardCharsets.UTF_8)); StringBuilder builder = new StringBuilder(); for (byte aByte : bytes) { builder.append(Integer.toHexString((255 & aByte) | (-256)).substring(6)); } return builder.toString(); } }