37 lines
1.3 KiB
Java
37 lines
1.3 KiB
Java
package com.ubt.jimu.utils;
|
|
|
|
import com.ijm.dataencryption.de.DataDecryptTool;
|
|
import java.io.UnsupportedEncodingException;
|
|
import java.security.MessageDigest;
|
|
import java.security.NoSuchAlgorithmException;
|
|
|
|
/* loaded from: classes2.dex */
|
|
public class EncryptUtils {
|
|
public static String a(String str, int i) {
|
|
try {
|
|
MessageDigest messageDigest = MessageDigest.getInstance("MD5");
|
|
messageDigest.update(str.getBytes());
|
|
byte[] digest = messageDigest.digest();
|
|
StringBuffer stringBuffer = new StringBuffer("");
|
|
for (int i2 = 0; i2 < digest.length; i2++) {
|
|
int i3 = digest[i2];
|
|
if (i3 < 0) {
|
|
i3 += DataDecryptTool.DECRYPT_ALL_FILE;
|
|
}
|
|
if (i3 < 16) {
|
|
stringBuffer.append("0");
|
|
}
|
|
stringBuffer.append(Integer.toHexString(i3));
|
|
}
|
|
return i == 32 ? stringBuffer.toString().toUpperCase() : stringBuffer.toString().substring(8, 24).toUpperCase();
|
|
} catch (NoSuchAlgorithmException e) {
|
|
e.printStackTrace();
|
|
return null;
|
|
}
|
|
}
|
|
|
|
public static String a(byte[] bArr) throws UnsupportedEncodingException {
|
|
return Base64.a(bArr, "UTF-8");
|
|
}
|
|
}
|