73 lines
2.0 KiB
Java
73 lines
2.0 KiB
Java
package com.pingan.ai;
|
|
|
|
import java.io.InputStream;
|
|
import java.security.MessageDigest;
|
|
import java.security.NoSuchAlgorithmException;
|
|
|
|
/* loaded from: classes3.dex */
|
|
public class v {
|
|
public static final char[] a = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'};
|
|
public static final char[] b = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'};
|
|
|
|
public static char[] a(byte[] bArr) {
|
|
return a(bArr, true);
|
|
}
|
|
|
|
public static String b(InputStream inputStream) {
|
|
return b(a(inputStream));
|
|
}
|
|
|
|
public static char[] a(byte[] bArr, boolean z) {
|
|
return a(bArr, z ? a : b);
|
|
}
|
|
|
|
public static String b(byte[] bArr) {
|
|
return new String(a(bArr));
|
|
}
|
|
|
|
public static char[] a(byte[] bArr, char[] cArr) {
|
|
int length = bArr.length;
|
|
char[] cArr2 = new char[length << 1];
|
|
int i = 0;
|
|
int i2 = 0;
|
|
while (i2 < length) {
|
|
byte b2 = bArr[i2];
|
|
cArr2[i] = cArr[(b2 & 240) >>> 4];
|
|
cArr2[i + 1] = cArr[b2 & 15];
|
|
i2++;
|
|
i += 2;
|
|
}
|
|
return cArr2;
|
|
}
|
|
|
|
public static MessageDigest b(MessageDigest messageDigest, InputStream inputStream) {
|
|
byte[] bArr = new byte[1024];
|
|
int read = inputStream.read(bArr, 0, 1024);
|
|
while (read >= 0) {
|
|
messageDigest.update(bArr, 0, read);
|
|
read = inputStream.read(bArr, 0, 1024);
|
|
}
|
|
return messageDigest;
|
|
}
|
|
|
|
public static byte[] a(InputStream inputStream) {
|
|
return a(a(), inputStream);
|
|
}
|
|
|
|
public static byte[] a(MessageDigest messageDigest, InputStream inputStream) {
|
|
return b(messageDigest, inputStream).digest();
|
|
}
|
|
|
|
public static MessageDigest a() {
|
|
return a("MD5");
|
|
}
|
|
|
|
public static MessageDigest a(String str) {
|
|
try {
|
|
return MessageDigest.getInstance(str);
|
|
} catch (NoSuchAlgorithmException e) {
|
|
throw new IllegalArgumentException(e);
|
|
}
|
|
}
|
|
}
|