EnDeCodeUtils.smali
.class public final Lcom/cleanmaster/base/util/compress/EnDeCodeUtils;
.super Ljava/lang/Object;
.source "EnDeCodeUtils.java"
# static fields
.field private static final HEXES:[C
# direct methods
.method static constructor <clinit>()V
.registers 1
.prologue
.line 29
const/16 v0, 0x10
new-array v0, v0, [C
fill-array-data v0, :array_a
sput-object v0, Lcom/cleanmaster/base/util/compress/EnDeCodeUtils;->HEXES:[C
return-void
:array_a
.array-data 2
0x30s
0x31s
0x32s
0x33s
0x34s
0x35s
0x36s
0x37s
0x38s
0x39s
0x61s
0x62s
0x63s
0x64s
0x65s
0x66s
.end array-data
.end method
.method public constructor <init>()V
.registers 1
.prologue
.line 11
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
return-void
.end method
.method public static byteToHexString([B)Ljava/lang/String;
.registers 7
.prologue
.line 31
if-nez p0, :cond_4
.line 32
const/4 v0, 0x0
.line 45
:goto_3
return-object v0
.line 35
:cond_4
array-length v1, p0
.line 36
if-nez v1, :cond_a
.line 37
const-string v0, ""
goto :goto_3
.line 39
:cond_a
mul-int/lit8 v0, v1, 0x2
new-array v2, v0, [C
.line 40
const/4 v0, 0x0
:goto_f
if-ge v0, v1, :cond_30
.line 41
mul-int/lit8 v3, v0, 0x2
sget-object v4, Lcom/cleanmaster/base/util/compress/EnDeCodeUtils;->HEXES:[C
aget-byte v5, p0, v0
and-int/lit16 v5, v5, 0xf0
ushr-int/lit8 v5, v5, 0x4
aget-char v4, v4, v5
aput-char v4, v2, v3
.line 42
mul-int/lit8 v3, v0, 0x2
add-int/lit8 v3, v3, 0x1
sget-object v4, Lcom/cleanmaster/base/util/compress/EnDeCodeUtils;->HEXES:[C
aget-byte v5, p0, v0
and-int/lit8 v5, v5, 0xf
aget-char v4, v4, v5
aput-char v4, v2, v3
.line 40
add-int/lit8 v0, v0, 0x1
goto :goto_f
.line 44
:cond_30
new-instance v0, Ljava/lang/String;
invoke-direct {v0, v2}, Ljava/lang/String;-><init>([C)V
goto :goto_3
.end method
.method public static byteToHexString([BII)Ljava/lang/String;
.registers 8
.prologue
.line 49
if-nez p0, :cond_4
.line 50
const/4 v0, 0x0
.line 64
:goto_3
return-object v0
.line 53
:cond_4
array-length v0, p0
sub-int/2addr v0, p1
.line 54
if-le p2, v0, :cond_9
move p2, v0
.line 55
:cond_9
if-nez p2, :cond_e
.line 56
const-string v0, ""
goto :goto_3
.line 58
:cond_e
mul-int/lit8 v0, p2, 0x2
new-array v1, v0, [C
.line 59
const/4 v0, 0x0
:goto_13
if-ge v0, p2, :cond_38
.line 60
mul-int/lit8 v2, v0, 0x2
sget-object v3, Lcom/cleanmaster/base/util/compress/EnDeCodeUtils;->HEXES:[C
add-int v4, v0, p1
aget-byte v4, p0, v4
and-int/lit16 v4, v4, 0xf0
ushr-int/lit8 v4, v4, 0x4
aget-char v3, v3, v4
aput-char v3, v1, v2
.line 61
mul-int/lit8 v2, v0, 0x2
add-int/lit8 v2, v2, 0x1
sget-object v3, Lcom/cleanmaster/base/util/compress/EnDeCodeUtils;->HEXES:[C
add-int v4, v0, p1
aget-byte v4, p0, v4
and-int/lit8 v4, v4, 0xf
aget-char v3, v3, v4
aput-char v3, v1, v2
.line 59
add-int/lit8 v0, v0, 0x1
goto :goto_13
.line 63
:cond_38
new-instance v0, Ljava/lang/String;
invoke-direct {v0, v1}, Ljava/lang/String;-><init>([C)V
goto :goto_3
.end method
.method public static bytesToInt([BI)I
.registers 6
.prologue
const/4 v0, 0x0
.line 156
move v1, v0
.line 157
:goto_2
const/4 v2, 0x4
if-ge v0, v2, :cond_12
.line 158
add-int v2, p1, v0
aget-byte v2, p0, v2
and-int/lit16 v2, v2, 0xff
mul-int/lit8 v3, v0, 0x8
shl-int/2addr v2, v3
or-int/2addr v1, v2
.line 157
add-int/lit8 v0, v0, 0x1
goto :goto_2
.line 160
:cond_12
return v1
.end method
.method public static copyHexStringtoBytes(Ljava/lang/String;[BII)V
.registers 8
.prologue
.line 95
invoke-virtual {p0}, Ljava/lang/String;->length()I
move-result v0
div-int/lit8 v0, v0, 0x2
.line 96
if-le v0, p3, :cond_32
.line 101
:goto_8
const/4 v0, 0x0
:goto_9
if-ge v0, p3, :cond_31
.line 102
mul-int/lit8 v1, v0, 0x2
.line 103
invoke-virtual {p0, v1}, Ljava/lang/String;->charAt(I)C
move-result v2
invoke-static {v2}, Lcom/cleanmaster/base/util/compress/EnDeCodeUtils;->hexChartoByte(C)B
move-result v2
.line 104
add-int/lit8 v1, v1, 0x1
invoke-virtual {p0, v1}, Ljava/lang/String;->charAt(I)C
move-result v1
invoke-static {v1}, Lcom/cleanmaster/base/util/compress/EnDeCodeUtils;->hexChartoByte(C)B
move-result v1
.line 105
add-int v3, p2, v0
shl-int/lit8 v2, v2, 0x4
int-to-byte v2, v2
aput-byte v2, p1, v3
.line 106
add-int v2, p2, v0
aget-byte v3, p1, v2
or-int/2addr v1, v3
int-to-byte v1, v1
aput-byte v1, p1, v2
.line 101
add-int/lit8 v0, v0, 0x1
goto :goto_9
.line 108
:cond_31
return-void
:cond_32
move p3, v0
goto :goto_8
.end method
.method public static copyIntToBytes(I[BI)V
.registers 6
.prologue
.line 150
const/4 v0, 0x0
:goto_1
const/4 v1, 0x4
if-ge v0, v1, :cond_10
.line 151
add-int v1, p2, v0
mul-int/lit8 v2, v0, 0x8
ushr-int v2, p0, v2
int-to-byte v2, v2
aput-byte v2, p1, v1
.line 150
add-int/lit8 v0, v0, 0x1
goto :goto_1
.line 153
:cond_10
return-void
.end method
.method public static copyShortToBytes(S[BI)V
.registers 6
.prologue
.line 124
const/4 v0, 0x0
:goto_1
const/4 v1, 0x2
if-ge v0, v1, :cond_10
.line 125
add-int v1, p2, v0
mul-int/lit8 v2, v0, 0x8
ushr-int v2, p0, v2
int-to-byte v2, v2
aput-byte v2, p1, v1
.line 124
add-int/lit8 v0, v0, 0x1
goto :goto_1
.line 127
:cond_10
return-void
.end method
.method public static decodeInt([BI)I
.registers 5
.prologue
const/4 v0, 0x0
.line 307
array-length v1, p0
sub-int/2addr v1, p1
const/4 v2, 0x4
if-ge v1, v2, :cond_7
.line 316
:goto_6
return v0
.line 312
:cond_7
aget-byte v1, p0, p1
shl-int/lit8 v1, v1, 0x18
const/high16 v2, -0x1000000
and-int/2addr v1, v2
or-int/2addr v0, v1
.line 313
add-int/lit8 v1, p1, 0x1
aget-byte v1, p0, v1
shl-int/lit8 v1, v1, 0x10
const/high16 v2, 0xff0000
and-int/2addr v1, v2
or-int/2addr v0, v1
.line 314
add-int/lit8 v1, p1, 0x2
aget-byte v1, p0, v1
shl-int/lit8 v1, v1, 0x8
const v2, 0xff00
and-int/2addr v1, v2
or-int/2addr v0, v1
.line 315
add-int/lit8 v1, p1, 0x3
aget-byte v1, p0, v1
and-int/lit16 v1, v1, 0xff
or-int/2addr v0, v1
.line 316
goto :goto_6
.end method
.method public static decodeInt16([BI)S
.registers 5
.prologue
const/4 v0, 0x0
.line 325
array-length v1, p0
sub-int/2addr v1, p1
const/4 v2, 0x2
if-ge v1, v2, :cond_7
.line 332
:goto_6
return v0
.line 330
:cond_7
aget-byte v1, p0, p1
shl-int/lit8 v1, v1, 0x8
const v2, 0xff00
and-int/2addr v1, v2
or-int/2addr v0, v1
int-to-short v0, v0
.line 331
add-int/lit8 v1, p1, 0x1
aget-byte v1, p0, v1
and-int/lit16 v1, v1, 0xff
or-int/2addr v0, v1
int-to-short v0, v0
.line 332
goto :goto_6
.end method
.method public static decodeLong([BI)J
.registers 11
.prologue
const/high16 v7, 0xff0000
const v8, 0xff00
const/high16 v6, -0x1000000
const-wide/16 v2, 0x0
.line 275
array-length v0, p0
sub-int/2addr v0, p1
const/16 v1, 0x8
if-ge v0, v1, :cond_11
move-wide v0, v2
.line 297
:goto_10
return-wide v0
.line 282
:cond_11
aget-byte v0, p0, p1
shl-int/lit8 v0, v0, 0x18
and-int/2addr v0, v6
int-to-long v0, v0
or-long/2addr v0, v2
.line 283
add-int/lit8 v4, p1, 0x1
aget-byte v4, p0, v4
shl-int/lit8 v4, v4, 0x10
and-int/2addr v4, v7
int-to-long v4, v4
or-long/2addr v0, v4
.line 284
add-int/lit8 v4, p1, 0x2
aget-byte v4, p0, v4
shl-int/lit8 v4, v4, 0x8
and-int/2addr v4, v8
int-to-long v4, v4
or-long/2addr v0, v4
.line 285
add-int/lit8 v4, p1, 0x3
aget-byte v4, p0, v4
and-int/lit16 v4, v4, 0xff
int-to-long v4, v4
or-long/2addr v4, v0
.line 287
add-int/lit8 v0, p1, 0x4
aget-byte v0, p0, v0
shl-int/lit8 v0, v0, 0x18
and-int/2addr v0, v6
int-to-long v0, v0
or-long/2addr v0, v2
.line 288
add-int/lit8 v6, p1, 0x5
aget-byte v6, p0, v6
shl-int/lit8 v6, v6, 0x10
and-int/2addr v6, v7
int-to-long v6, v6
or-long/2addr v0, v6
.line 289
add-int/lit8 v6, p1, 0x6
aget-byte v6, p0, v6
shl-int/lit8 v6, v6, 0x8
and-int/2addr v6, v8
int-to-long v6, v6
or-long/2addr v0, v6
.line 290
add-int/lit8 v6, p1, 0x7
aget-byte v6, p0, v6
and-int/lit16 v6, v6, 0xff
int-to-long v6, v6
or-long/2addr v0, v6
.line 292
cmp-long v2, v0, v2
if-gez v2, :cond_63
.line 293
const-wide/high16 v2, 0x4000000000000000L # 2.0
const-wide/high16 v6, 0x4040000000000000L # 32.0
invoke-static {v2, v3, v6, v7}, Ljava/lang/Math;->pow(DD)D
move-result-wide v2
double-to-long v2, v2
add-long/2addr v0, v2
.line 296
:cond_63
const/16 v2, 0x20
shl-long v2, v4, v2
or-long/2addr v0, v2
.line 297
goto :goto_10
.end method
.method public static encode(I[BI)V
.registers 5
.prologue
.line 236
array-length v0, p1
sub-int/2addr v0, p2
const/4 v1, 0x4
if-ge v0, v1, :cond_6
.line 249
:goto_5
return-void
.line 241
:cond_6
shr-int/lit8 v0, p0, 0x18
and-int/lit16 v0, v0, 0xff
int-to-byte v0, v0
.line 242
aput-byte v0, p1, p2
.line 243
shr-int/lit8 v0, p0, 0x10
and-int/lit16 v0, v0, 0xff
int-to-byte v0, v0
.line 244
add-int/lit8 v1, p2, 0x1
aput-byte v0, p1, v1
.line 245
shr-int/lit8 v0, p0, 0x8
and-int/lit16 v0, v0, 0xff
int-to-byte v0, v0
.line 246
add-int/lit8 v1, p2, 0x2
aput-byte v0, p1, v1
.line 247
and-int/lit16 v0, p0, 0xff
int-to-byte v0, v0
.line 248
add-int/lit8 v1, p2, 0x3
aput-byte v0, p1, v1
goto :goto_5
.end method
.method public static encode(J[BI)V
.registers 10
.prologue
const/16 v4, 0x8
const-wide/16 v2, 0xff
.line 206
array-length v0, p2
sub-int/2addr v0, p3
if-ge v0, v4, :cond_9
.line 227
:goto_8
return-void
.line 211
:cond_9
const/16 v0, 0x38
shr-long v0, p0, v0
and-long/2addr v0, v2
long-to-int v0, v0
int-to-byte v0, v0
.line 212
aput-byte v0, p2, p3
.line 213
const/16 v0, 0x30
shr-long v0, p0, v0
and-long/2addr v0, v2
long-to-int v0, v0
int-to-byte v0, v0
.line 214
add-int/lit8 v1, p3, 0x1
aput-byte v0, p2, v1
.line 215
const/16 v0, 0x28
shr-long v0, p0, v0
and-long/2addr v0, v2
long-to-int v0, v0
int-to-byte v0, v0
.line 216
add-int/lit8 v1, p3, 0x2
aput-byte v0, p2, v1
.line 217
const/16 v0, 0x20
shr-long v0, p0, v0
and-long/2addr v0, v2
long-to-int v0, v0
int-to-byte v0, v0
.line 218
add-int/lit8 v1, p3, 0x3
aput-byte v0, p2, v1
.line 219
const/16 v0, 0x18
shr-long v0, p0, v0
and-long/2addr v0, v2
long-to-int v0, v0
int-to-byte v0, v0
.line 220
add-int/lit8 v1, p3, 0x4
aput-byte v0, p2, v1
.line 221
const/16 v0, 0x10
shr-long v0, p0, v0
and-long/2addr v0, v2
long-to-int v0, v0
int-to-byte v0, v0
.line 222
add-int/lit8 v1, p3, 0x5
aput-byte v0, p2, v1
.line 223
shr-long v0, p0, v4
and-long/2addr v0, v2
long-to-int v0, v0
int-to-byte v0, v0
.line 224
add-int/lit8 v1, p3, 0x6
aput-byte v0, p2, v1
.line 225
and-long v0, p0, v2
long-to-int v0, v0
int-to-byte v0, v0
.line 226
add-int/lit8 v1, p3, 0x7
aput-byte v0, p2, v1
goto :goto_8
.end method
.method public static encode(S[BI)V
.registers 5
.prologue
.line 257
array-length v0, p1
sub-int/2addr v0, p2
const/4 v1, 0x2
if-ge v0, v1, :cond_6
.line 266
:goto_5
return-void
.line 262
:cond_6
shr-int/lit8 v0, p0, 0x8
and-int/lit16 v0, v0, 0xff
int-to-byte v0, v0
.line 263
aput-byte v0, p1, p2
.line 264
and-int/lit16 v0, p0, 0xff
int-to-byte v0, v0
.line 265
add-int/lit8 v1, p2, 0x1
aput-byte v0, p1, v1
goto :goto_5
.end method
.method public static hexChartoByte(C)B
.registers 3
.prologue
.line 81
const/4 v0, 0x0
.line 82
const/16 v1, 0x30
if-lt p0, v1, :cond_d
const/16 v1, 0x39
if-gt p0, v1, :cond_d
.line 83
add-int/lit8 v0, p0, -0x30
int-to-byte v0, v0
.line 91
:cond_c
:goto_c
return v0
.line 84
:cond_d
const/16 v1, 0x61
if-lt p0, v1, :cond_1b
const/16 v1, 0x66
if-gt p0, v1, :cond_1b
.line 85
add-int/lit8 v0, p0, -0x61
add-int/lit8 v0, v0, 0xa
int-to-byte v0, v0
goto :goto_c
.line 86
:cond_1b
const/16 v1, 0x41
if-lt p0, v1, :cond_c
const/16 v1, 0x46
if-gt p0, v1, :cond_c
.line 87
add-int/lit8 v0, p0, -0x41
add-int/lit8 v0, v0, 0xa
int-to-byte v0, v0
goto :goto_c
.end method
.method public static hexStringtoBytes(Ljava/lang/String;)[B
.registers 4
.prologue
.line 75
invoke-virtual {p0}, Ljava/lang/String;->length()I
move-result v0
div-int/lit8 v0, v0, 0x2
new-array v0, v0, [B
.line 76
const/4 v1, 0x0
array-length v2, v0
invoke-static {p0, v0, v1, v2}, Lcom/cleanmaster/base/util/compress/EnDeCodeUtils;->copyHexStringtoBytes(Ljava/lang/String;[BII)V
.line 77
return-object v0
.end method
.method public static xorEncodeBytes([BII[B)V
.registers 10
.prologue
const/4 v2, 0x0
.line 14
add-int v1, p1, p2
.line 15
array-length v0, p0
.line 16
if-le v1, v0, :cond_1b
.line 19
:goto_6
array-length v3, p3
move v1, v2
.line 20
:goto_8
if-ge p1, v0, :cond_1a
.line 21
if-ne v1, v3, :cond_d
move v1, v2
.line 24
:cond_d
aget-byte v4, p0, p1
aget-byte v5, p3, v1
xor-int/2addr v4, v5
int-to-byte v4, v4
aput-byte v4, p0, p1
.line 20
add-int/lit8 p1, p1, 0x1
add-int/lit8 v1, v1, 0x1
goto :goto_8
.line 26
:cond_1a
return-void
:cond_1b
move v0, v1
goto :goto_6
.end method