what-the-bank/sources/o/yyw.java

55 lines
1.6 KiB
Java
Raw Permalink Normal View History

2024-07-27 18:17:47 +07:00
package o;
import android.text.TextUtils;
import java.io.UnsupportedEncodingException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import org.bouncycastle.pqc.jcajce.spec.McElieceCCA2KeyGenParameterSpec;
/* loaded from: classes2.dex */
public final class yyw {
private static final String[] b = {McElieceCCA2KeyGenParameterSpec.SHA256, McElieceCCA2KeyGenParameterSpec.SHA384, McElieceCCA2KeyGenParameterSpec.SHA512};
private static byte[] c(byte[] bArr, String str) {
if (bArr != null && !TextUtils.isEmpty(str)) {
if (!d(str)) {
return new byte[0];
}
try {
MessageDigest messageDigest = MessageDigest.getInstance(str);
messageDigest.update(bArr);
return messageDigest.digest();
} catch (NoSuchAlgorithmException unused) {
return new byte[0];
}
}
return new byte[0];
}
private static boolean d(String str) {
for (String str2 : b) {
if (str2.equals(str)) {
return true;
}
}
return false;
}
public static String e(String str) {
return e(str, McElieceCCA2KeyGenParameterSpec.SHA256);
}
private static String e(String str, String str2) {
byte[] bArr;
if (TextUtils.isEmpty(str) || TextUtils.isEmpty(str2) || !d(str2)) {
return "";
}
try {
bArr = str.getBytes("UTF-8");
} catch (UnsupportedEncodingException unused) {
bArr = new byte[0];
}
return Yqs.b(c(bArr, str2));
}
}