MD5加密代码
package com.albedo.security; import java.math.BigInteger; import java.security.MessageDigest; /** * MD5加密 */ public class Md5Utils { public static String encrypt(String plainText) throws Exception{ byte[] secretBytes = MessageDigest.getInstance("md5").digest( plainText.getBytes()); String md5code = new BigInteger(1, secretBytes).toString(16); for (int i = 0; i < 32 - md5code.length(); i++) { md5code = "0" + md5code; } return md5code; } }