All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.jackpanz.spring.util.MD5 Maven / Gradle / Ivy

package com.github.jackpanz.spring.util;

import org.apache.commons.codec.digest.DigestUtils;

/**
 * Created by Administrator on 2016/2/19.
 */
public class MD5 {

    final static String salt = "iRimDV9kTpnhUkni";

    @Deprecated
    public static String encodePassword(String password) {
        return md5(password, salt);
    }

    @Deprecated
    public static String encodePasswordBlank(String password) {
        return md5(password, null);
    }

    @Deprecated
    public static String encodePassword(String password, String salt) {
        return md5(password, salt);
    }

    @Deprecated
    public static String doubleMD5(String password) {
        return md5Double(password);
    }

    public static String md5(String text, String salt) {
        return salt == null ? DigestUtils.md5Hex(text) : DigestUtils.md5Hex(text + "{" + salt + "}");
    }

    public static String md5(String text) {
        return DigestUtils.md5Hex(text);
    }

    public static String md5Double(String text) {
        return md5(md5(text));
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy