48 lines
1.4 KiB
Java
48 lines
1.4 KiB
Java
package com.baidu.cloud.media.download;
|
|
|
|
import android.content.Context;
|
|
|
|
/* loaded from: classes.dex */
|
|
public class LocalHlsSec {
|
|
static {
|
|
System.loadLibrary("hls-download");
|
|
}
|
|
|
|
public static String bytes2HexStr(byte[] bArr) {
|
|
if (bArr == null || bArr.length == 0) {
|
|
return null;
|
|
}
|
|
StringBuffer stringBuffer = new StringBuffer();
|
|
for (int i = 0; i < bArr.length; i++) {
|
|
if ((bArr[i] & 255) < 16) {
|
|
stringBuffer.append("0");
|
|
}
|
|
stringBuffer.append(Long.toHexString(bArr[i] & 255));
|
|
}
|
|
return stringBuffer.toString();
|
|
}
|
|
|
|
public static String decryptStr(Context context, String str) {
|
|
return bytes2HexStr(new LocalHlsSec().crypt(context, hexStr2Bytes(str), 1));
|
|
}
|
|
|
|
public static byte[] hexStr2Bytes(String str) {
|
|
if (str.length() < 1) {
|
|
return null;
|
|
}
|
|
byte[] bArr = new byte[str.length() / 2];
|
|
for (int i = 0; i < str.length() / 2; i++) {
|
|
int i2 = i * 2;
|
|
int i3 = i2 + 1;
|
|
bArr[i] = (byte) ((Integer.parseInt(str.substring(i2, i3), 16) * 16) + Integer.parseInt(str.substring(i3, i2 + 2), 16));
|
|
}
|
|
return bArr;
|
|
}
|
|
|
|
public native byte[] crypt(Context context, byte[] bArr, int i);
|
|
|
|
public String getMD5(String str) {
|
|
return a.b(str);
|
|
}
|
|
}
|