2023-02-15 09:08:22 +00:00
|
|
|
package com.zhangmeng.tools.utils;
|
|
|
|
|
|
|
|
|
|
import cn.hutool.crypto.digest.DigestUtil;
|
|
|
|
|
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
|
|
|
|
|
|
2023-02-16 01:21:09 +00:00
|
|
|
/**
|
|
|
|
|
* @author : 芊芊墨客
|
|
|
|
|
* @version : 1.0
|
|
|
|
|
* @date : 2023-02-16 09:19
|
|
|
|
|
*/
|
2023-02-15 09:08:22 +00:00
|
|
|
public class EncryptUtils {
|
|
|
|
|
|
|
|
|
|
public static String md5(String text){
|
|
|
|
|
return DigestUtil.md5Hex(text);
|
|
|
|
|
}
|
|
|
|
|
public static String md5_16(String text){
|
|
|
|
|
return DigestUtil.md5Hex16(text);
|
|
|
|
|
}
|
|
|
|
|
public static String spring_security(String text){
|
|
|
|
|
return new BCryptPasswordEncoder().encode(text);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static void main(String[] args) {
|
|
|
|
|
String text = "123456";
|
|
|
|
|
|
|
|
|
|
System.out.println(md5(text));
|
|
|
|
|
System.out.println(md5_16(text));
|
|
|
|
|
}
|
|
|
|
|
}
|