i.java 源代码
package k2;
import android.os.Environment;
import com.inmobi.media.fd;
import com.x8zs.morgoo.helper.Log;
import java.io.File;
import java.io.UnsupportedEncodingException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.Locale;
public class i {
public static String a(String str, Object... objArr) {
return String.format(Locale.ENGLISH, str, objArr);
}
public static String b(String str) {
return g(str);
}
public static String c(String str, String str2) {
if (str2 != null) {
if (str != null) {
return a("%s%s%s", str, File.separator, str2);
}
throw new IllegalStateException("can't generate real path, the directory is null");
}
throw new IllegalStateException("can't generate real path, the file name is null");
}
public static int d(String str, String str2, boolean z6) {
if (z6) {
return g(a("%sp%s@dir", str, str2)).hashCode();
}
return g(a("%sp%s", str, str2)).hashCode();
}
public static String e(String str) {
return c(f(), b(str));
}
public static String f() {
File file = new File(new File(Environment.getExternalStorageDirectory(), Log.TAG), "downloaded_apk");
if (!file.exists()) {
file.mkdirs();
}
return file.getAbsolutePath();
}
public static String g(String str) {
try {
byte[] digest = MessageDigest.getInstance("MD5").digest(str.getBytes("UTF-8"));
StringBuilder sb = new StringBuilder(digest.length * 2);
for (byte b6 : digest) {
int i6 = b6 & fd.i.NETWORK_LOAD_LIMIT_DISABLED;
if (i6 < 16) {
sb.append("0");
}
sb.append(Integer.toHexString(i6));
}
return sb.toString();
} catch (UnsupportedEncodingException e6) {
throw new RuntimeException("Huh, UTF-8 should be supported?", e6);
} catch (NoSuchAlgorithmException e7) {
throw new RuntimeException("Huh, MD5 should be supported?", e7);
}
}
}