what-the-bank/sources/com/huawei/hms/framework/common/SecurityRandomHelper.java

47 lines
1.1 KiB
Java
Raw Permalink Normal View History

2024-07-27 18:17:47 +07:00
package com.huawei.hms.framework.common;
import java.security.SecureRandom;
import o.BAC;
import o.Yqs;
/* loaded from: classes2.dex */
public class SecurityRandomHelper {
public static volatile SecurityRandomHelper instance;
public static SecurityRandomHelper getInstance() {
if (instance == null) {
synchronized (SecurityRandomHelper.class) {
if (instance == null) {
instance = new SecurityRandomHelper();
}
}
}
return instance;
}
private SecurityRandomHelper() {
}
public byte[] generateSecureRandom(int i) {
SecureRandom d = BAC.d();
if (d == null) {
return new byte[0];
}
byte[] bArr = new byte[i];
d.nextBytes(bArr);
return bArr;
}
public String generateSecureRandomStr(int i) {
byte[] bArr;
SecureRandom d = BAC.d();
if (d == null) {
bArr = new byte[0];
} else {
bArr = new byte[i];
d.nextBytes(bArr);
}
return Yqs.b(bArr);
}
}