what-the-bank/sources/com/huawei/hms/hatool/x.java

188 lines
5.5 KiB
Java
Raw Permalink Normal View History

2024-07-27 18:17:47 +07:00
package com.huawei.hms.hatool;
import java.io.File;
import java.io.IOException;
import java.security.SecureRandom;
import o.AeE;
import o.BAC;
import o.Yqs;
/* loaded from: classes2.dex */
public class x {
private String a = q0.i().getFilesDir().getPath();
private String b(String str) {
byte[] bArr;
File file = new File(a(str), "hianalytics_".concat(String.valueOf(str)));
if (a(file)) {
return k1.a(file);
}
SecureRandom d = BAC.d();
if (d == null) {
bArr = new byte[0];
} else {
byte[] bArr2 = new byte[128];
d.nextBytes(bArr2);
bArr = bArr2;
}
String b = Yqs.b(bArr);
k1.a(file, b);
return b;
}
public String a() {
String b;
String b2;
String b3;
String b4;
byte[] bArr;
byte[] bArr2;
byte[] bArr3;
byte[] bArr4;
String d = d();
if (b()) {
v.c("hmsSdk", "refresh components");
SecureRandom d2 = BAC.d();
if (d2 == null) {
bArr = new byte[0];
} else {
byte[] bArr5 = new byte[128];
d2.nextBytes(bArr5);
bArr = bArr5;
}
b = Yqs.b(bArr);
a("aprpap", b);
SecureRandom d3 = BAC.d();
if (d3 == null) {
bArr2 = new byte[0];
} else {
byte[] bArr6 = new byte[128];
d3.nextBytes(bArr6);
bArr2 = bArr6;
}
b2 = Yqs.b(bArr2);
a("febdoc", b2);
SecureRandom d4 = BAC.d();
if (d4 == null) {
bArr3 = new byte[0];
} else {
byte[] bArr7 = new byte[128];
d4.nextBytes(bArr7);
bArr3 = bArr7;
}
b3 = Yqs.b(bArr3);
a("marfil", b3);
SecureRandom d5 = BAC.d();
if (d5 == null) {
bArr4 = new byte[0];
} else {
byte[] bArr8 = new byte[128];
d5.nextBytes(bArr8);
bArr4 = bArr8;
}
b4 = Yqs.b(bArr4);
a("maywnj", b4);
d.b(q0.i(), "Privacy_MY", "assemblyFlash", System.currentTimeMillis());
} else {
b = b("aprpap");
b2 = b("febdoc");
b3 = b("marfil");
b4 = b("maywnj");
}
return Yqs.b(AeE.d(a(b, b2, b3, d), Yqs.a(b4)));
}
private String d() {
return "f6040d0e807aaec325ecf44823765544e92905158169f694b282bf17388632cf95a83bae7d2d235c1f039b0df1dcca5fda619b6f7f459f2ff8d70ddb7b601592fe29fcae58c028f319b3b12495e67aa5390942a997a8cb572c8030b2df5c2b622608bea02b0c3e5d4dff3f72c9e3204049a45c0760cd3604af8d57f0e0c693cc";
}
public static boolean c() {
StringBuilder sb = new StringBuilder();
sb.append(q0.i().getFilesDir().getPath());
sb.append("/hms");
return b(new File(sb.toString()));
}
private static boolean b(File file) {
File[] listFiles;
if (file == null || !file.exists() || !file.isDirectory() || (listFiles = file.listFiles()) == null || listFiles.length == 0) {
return false;
}
for (File file2 : listFiles) {
if (file2.isFile()) {
if (!file2.delete()) {
StringBuilder sb = new StringBuilder("delete file failed : ");
sb.append(file2.getName());
v.c("hmsSdk", sb.toString());
}
} else if (file2.isDirectory()) {
b(file2);
}
}
return file.delete();
}
private boolean b() {
long a = d.a(q0.i(), "Privacy_MY", "assemblyFlash", -1L);
if (-1 != a) {
return System.currentTimeMillis() - a > 31536000000L;
}
v.c("hmsSdk", "First init components");
return true;
}
private char[] a(String str, String str2, String str3, String str4) {
byte[] a = Yqs.a(str);
byte[] a2 = Yqs.a(str2);
byte[] a3 = Yqs.a(str3);
byte[] a4 = Yqs.a(str4);
int length = a.length;
if (length > a2.length) {
length = a2.length;
}
if (length > a3.length) {
length = a3.length;
}
if (length > a4.length) {
length = a4.length;
}
char[] cArr = new char[length];
for (int i = 0; i < length; i++) {
cArr[i] = (char) (((a[i] ^ a2[i]) ^ a3[i]) ^ a4[i]);
}
return cArr;
}
private boolean a(File file) {
if (file.exists()) {
return true;
}
try {
return file.createNewFile();
} catch (IOException unused) {
v.f("hmsSdk", "create new file error!");
return false;
}
}
private void a(String str, String str2) {
File file = new File(a(str));
File file2 = new File(a(str), "hianalytics_".concat(String.valueOf(str)));
if (!file.exists() && file.mkdirs()) {
v.c("hmsSdk", "file directory is mkdirs");
}
if (a(file2)) {
k1.a(file2, str2);
} else {
v.f("hmsSdk", "refreshComponent():file is not found,and file is create failed");
}
}
private String a(String str) {
StringBuilder sb = new StringBuilder();
sb.append(this.a);
sb.append("/hms/component/".replace("component", str));
return sb.toString();
}
}