package com.stylefeng.guns.modular.system.util;
|
|
import lombok.SneakyThrows;
|
|
import java.security.MessageDigest;
|
|
public class MD5Util {
|
@SneakyThrows
|
public static String encrypt32(String encryptStr) {
|
MessageDigest md5 = MessageDigest.getInstance("MD5");
|
byte[] md5Bytes = md5.digest(encryptStr.getBytes());
|
StringBuilder hexValue = new StringBuilder();
|
for (int i = 0; i < md5Bytes.length; i++) {
|
int val = ((int) md5Bytes[i]) & 0xff;
|
if (val < 16) {
|
hexValue.append("0");
|
}
|
hexValue.append(Integer.toHexString(val));
|
}
|
return hexValue.toString().toUpperCase();
|
}
|
}
|