
com.allways.utils.Md5Util Maven / Gradle / Ivy
package com.allways.utils;
import com.allways.constants.Constants;
import org.springframework.util.DigestUtils;
import java.math.BigInteger;
/**
* @author lirui
*
**/
public class Md5Util {
public static String getPassword(String userName,String password,String loginTime) {
String tokenTmp = DigestUtils.md5DigestAsHex(String.valueOf(userName + "_" + password+"_"+loginTime).getBytes());
tokenTmp = new BigInteger(1, tokenTmp.getBytes()).toString(16);
return tokenTmp;
}
public static String getPassword(String userName,String password) {
return getPassword(userName,password, Constants.INITIAL_LOGIN_TIME);
}
public static void main(String[] args) {
System.out.println(getPassword("admin","123456"));
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy