springboot自带的MD5加密工具

import org.springframework.util.DigestUtils;

public class MD5Util {

    //盐,用于混交md5
    private static String salt = "asdwqAsd12_qS";

    /**
     * 生成md5
     * @param str
     * @return
     */
    public static String getMD5(String str) {
        String base = str + "/" + salt;
        String md5 = DigestUtils.md5DigestAsHex(base.getBytes());
        return md5;
    }

}

posted @ 2020-01-14 14:39  HanJunOvO  阅读(4849)  评论(0编辑  收藏  举报