依赖
<dependency> <groupId>commons-codec</groupId> <artifactId>commons-codec</artifactId> <version>1.14</version> </dependency>
工具类
public class MD5Utils { public static String md5Digest(String source , Integer salt){ char[] ca = source.toCharArray(); //混淆源数据 for(int i = 0 ; i < ca.length ; i++){ ca[i] = (char) (ca[i] + salt); } String target = new String(ca); String md5 = DigestUtils.md5Hex(target); return md5; } }