379 lines
		
	
	
		
			7.3 KiB
		
	
	
	
		
			Smali
		
	
	
	
	
	
			
		
		
	
	
			379 lines
		
	
	
		
			7.3 KiB
		
	
	
	
		
			Smali
		
	
	
	
	
	
| .class public Lorg/apache/commons/codec/binary/Hex;
 | |
| .super Ljava/lang/Object;
 | |
| .source "Hex.java"
 | |
| 
 | |
| # interfaces
 | |
| .implements Lorg/apache/commons/codec/BinaryEncoder;
 | |
| .implements Lorg/apache/commons/codec/BinaryDecoder;
 | |
| 
 | |
| 
 | |
| # static fields
 | |
| .field private static final DIGITS:[C
 | |
| 
 | |
| 
 | |
| # direct methods
 | |
| .method public static constructor <clinit>()V
 | |
|     .locals 1
 | |
| 
 | |
|     const/16 v0, 0x10
 | |
| 
 | |
|     new-array v0, v0, [C
 | |
| 
 | |
|     .line 1
 | |
|     fill-array-data v0, :array_0
 | |
| 
 | |
|     sput-object v0, Lorg/apache/commons/codec/binary/Hex;->DIGITS:[C
 | |
| 
 | |
|     return-void
 | |
| 
 | |
|     :array_0
 | |
|     .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
 | |
|     .locals 0
 | |
| 
 | |
|     .line 1
 | |
|     invoke-direct {p0}, Ljava/lang/Object;-><init>()V
 | |
| 
 | |
|     return-void
 | |
| .end method
 | |
| 
 | |
| .method public static decodeHex([C)[B
 | |
|     .locals 6
 | |
|     .annotation system Ldalvik/annotation/Throws;
 | |
|         value = {
 | |
|             Lorg/apache/commons/codec/DecoderException;
 | |
|         }
 | |
|     .end annotation
 | |
| 
 | |
|     .line 1
 | |
|     array-length v0, p0
 | |
| 
 | |
|     and-int/lit8 v1, v0, 0x1
 | |
| 
 | |
|     if-nez v1, :cond_1
 | |
| 
 | |
|     shr-int/lit8 v1, v0, 0x1
 | |
| 
 | |
|     .line 2
 | |
|     new-array v1, v1, [B
 | |
| 
 | |
|     const/4 v2, 0x0
 | |
| 
 | |
|     move v3, v2
 | |
| 
 | |
|     :goto_0
 | |
|     if-ge v2, v0, :cond_0
 | |
| 
 | |
|     .line 3
 | |
|     aget-char v4, p0, v2
 | |
| 
 | |
|     invoke-static {v4, v2}, Lorg/apache/commons/codec/binary/Hex;->toDigit(CI)I
 | |
| 
 | |
|     move-result v4
 | |
| 
 | |
|     shl-int/lit8 v4, v4, 0x4
 | |
| 
 | |
|     add-int/lit8 v2, v2, 0x1
 | |
| 
 | |
|     .line 4
 | |
|     aget-char v5, p0, v2
 | |
| 
 | |
|     invoke-static {v5, v2}, Lorg/apache/commons/codec/binary/Hex;->toDigit(CI)I
 | |
| 
 | |
|     move-result v5
 | |
| 
 | |
|     or-int/2addr v4, v5
 | |
| 
 | |
|     add-int/lit8 v2, v2, 0x1
 | |
| 
 | |
|     and-int/lit16 v4, v4, 0xff
 | |
| 
 | |
|     int-to-byte v4, v4
 | |
| 
 | |
|     .line 5
 | |
|     aput-byte v4, v1, v3
 | |
| 
 | |
|     add-int/lit8 v3, v3, 0x1
 | |
| 
 | |
|     goto :goto_0
 | |
| 
 | |
|     :cond_0
 | |
|     return-object v1
 | |
| 
 | |
|     .line 6
 | |
|     :cond_1
 | |
|     new-instance p0, Lorg/apache/commons/codec/DecoderException;
 | |
| 
 | |
|     const-string v0, "Odd number of characters."
 | |
| 
 | |
|     invoke-direct {p0, v0}, Lorg/apache/commons/codec/DecoderException;-><init>(Ljava/lang/String;)V
 | |
| 
 | |
|     throw p0
 | |
| .end method
 | |
| 
 | |
| .method public static encodeHex([B)[C
 | |
|     .locals 7
 | |
| 
 | |
|     .line 1
 | |
|     array-length v0, p0
 | |
| 
 | |
|     shl-int/lit8 v1, v0, 0x1
 | |
| 
 | |
|     .line 2
 | |
|     new-array v1, v1, [C
 | |
| 
 | |
|     const/4 v2, 0x0
 | |
| 
 | |
|     move v3, v2
 | |
| 
 | |
|     :goto_0
 | |
|     if-ge v2, v0, :cond_0
 | |
| 
 | |
|     add-int/lit8 v4, v3, 0x1
 | |
| 
 | |
|     .line 3
 | |
|     sget-object v5, Lorg/apache/commons/codec/binary/Hex;->DIGITS:[C
 | |
| 
 | |
|     aget-byte v6, p0, v2
 | |
| 
 | |
|     and-int/lit16 v6, v6, 0xf0
 | |
| 
 | |
|     ushr-int/lit8 v6, v6, 0x4
 | |
| 
 | |
|     aget-char v6, v5, v6
 | |
| 
 | |
|     aput-char v6, v1, v3
 | |
| 
 | |
|     add-int/lit8 v3, v4, 0x1
 | |
| 
 | |
|     .line 4
 | |
|     aget-byte v6, p0, v2
 | |
| 
 | |
|     and-int/lit8 v6, v6, 0xf
 | |
| 
 | |
|     aget-char v5, v5, v6
 | |
| 
 | |
|     aput-char v5, v1, v4
 | |
| 
 | |
|     add-int/lit8 v2, v2, 0x1
 | |
| 
 | |
|     goto :goto_0
 | |
| 
 | |
|     :cond_0
 | |
|     return-object v1
 | |
| .end method
 | |
| 
 | |
| .method public static toDigit(CI)I
 | |
|     .locals 3
 | |
|     .annotation system Ldalvik/annotation/Throws;
 | |
|         value = {
 | |
|             Lorg/apache/commons/codec/DecoderException;
 | |
|         }
 | |
|     .end annotation
 | |
| 
 | |
|     const/16 v0, 0x10
 | |
| 
 | |
|     .line 1
 | |
|     invoke-static {p0, v0}, Ljava/lang/Character;->digit(CI)I
 | |
| 
 | |
|     move-result v0
 | |
| 
 | |
|     const/4 v1, -0x1
 | |
| 
 | |
|     if-eq v0, v1, :cond_0
 | |
| 
 | |
|     return v0
 | |
| 
 | |
|     .line 2
 | |
|     :cond_0
 | |
|     new-instance v0, Lorg/apache/commons/codec/DecoderException;
 | |
| 
 | |
|     new-instance v1, Ljava/lang/StringBuffer;
 | |
| 
 | |
|     invoke-direct {v1}, Ljava/lang/StringBuffer;-><init>()V
 | |
| 
 | |
|     const-string v2, "Illegal hexadecimal charcter "
 | |
| 
 | |
|     invoke-virtual {v1, v2}, Ljava/lang/StringBuffer;->append(Ljava/lang/String;)Ljava/lang/StringBuffer;
 | |
| 
 | |
|     invoke-virtual {v1, p0}, Ljava/lang/StringBuffer;->append(C)Ljava/lang/StringBuffer;
 | |
| 
 | |
|     const-string p0, " at index "
 | |
| 
 | |
|     invoke-virtual {v1, p0}, Ljava/lang/StringBuffer;->append(Ljava/lang/String;)Ljava/lang/StringBuffer;
 | |
| 
 | |
|     invoke-virtual {v1, p1}, Ljava/lang/StringBuffer;->append(I)Ljava/lang/StringBuffer;
 | |
| 
 | |
|     invoke-virtual {v1}, Ljava/lang/StringBuffer;->toString()Ljava/lang/String;
 | |
| 
 | |
|     move-result-object p0
 | |
| 
 | |
|     invoke-direct {v0, p0}, Lorg/apache/commons/codec/DecoderException;-><init>(Ljava/lang/String;)V
 | |
| 
 | |
|     throw v0
 | |
| .end method
 | |
| 
 | |
| 
 | |
| # virtual methods
 | |
| .method public decode(Ljava/lang/Object;)Ljava/lang/Object;
 | |
|     .locals 1
 | |
|     .annotation system Ldalvik/annotation/Throws;
 | |
|         value = {
 | |
|             Lorg/apache/commons/codec/DecoderException;
 | |
|         }
 | |
|     .end annotation
 | |
| 
 | |
|     .line 2
 | |
|     :try_start_0
 | |
|     instance-of v0, p1, Ljava/lang/String;
 | |
| 
 | |
|     if-eqz v0, :cond_0
 | |
| 
 | |
|     check-cast p1, Ljava/lang/String;
 | |
| 
 | |
|     invoke-virtual {p1}, Ljava/lang/String;->toCharArray()[C
 | |
| 
 | |
|     move-result-object p1
 | |
| 
 | |
|     goto :goto_0
 | |
| 
 | |
|     :cond_0
 | |
|     check-cast p1, [C
 | |
| 
 | |
|     .line 3
 | |
|     :goto_0
 | |
|     invoke-static {p1}, Lorg/apache/commons/codec/binary/Hex;->decodeHex([C)[B
 | |
| 
 | |
|     move-result-object p1
 | |
|     :try_end_0
 | |
|     .catch Ljava/lang/ClassCastException; {:try_start_0 .. :try_end_0} :catch_0
 | |
| 
 | |
|     return-object p1
 | |
| 
 | |
|     :catch_0
 | |
|     move-exception p1
 | |
| 
 | |
|     .line 4
 | |
|     new-instance v0, Lorg/apache/commons/codec/DecoderException;
 | |
| 
 | |
|     invoke-virtual {p1}, Ljava/lang/ClassCastException;->getMessage()Ljava/lang/String;
 | |
| 
 | |
|     move-result-object p1
 | |
| 
 | |
|     invoke-direct {v0, p1}, Lorg/apache/commons/codec/DecoderException;-><init>(Ljava/lang/String;)V
 | |
| 
 | |
|     throw v0
 | |
| .end method
 | |
| 
 | |
| .method public decode([B)[B
 | |
|     .locals 1
 | |
|     .annotation system Ldalvik/annotation/Throws;
 | |
|         value = {
 | |
|             Lorg/apache/commons/codec/DecoderException;
 | |
|         }
 | |
|     .end annotation
 | |
| 
 | |
|     .line 1
 | |
|     new-instance v0, Ljava/lang/String;
 | |
| 
 | |
|     invoke-direct {v0, p1}, Ljava/lang/String;-><init>([B)V
 | |
| 
 | |
|     invoke-virtual {v0}, Ljava/lang/String;->toCharArray()[C
 | |
| 
 | |
|     move-result-object p1
 | |
| 
 | |
|     invoke-static {p1}, Lorg/apache/commons/codec/binary/Hex;->decodeHex([C)[B
 | |
| 
 | |
|     move-result-object p1
 | |
| 
 | |
|     return-object p1
 | |
| .end method
 | |
| 
 | |
| .method public encode(Ljava/lang/Object;)Ljava/lang/Object;
 | |
|     .locals 1
 | |
|     .annotation system Ldalvik/annotation/Throws;
 | |
|         value = {
 | |
|             Lorg/apache/commons/codec/EncoderException;
 | |
|         }
 | |
|     .end annotation
 | |
| 
 | |
|     .line 2
 | |
|     :try_start_0
 | |
|     instance-of v0, p1, Ljava/lang/String;
 | |
| 
 | |
|     if-eqz v0, :cond_0
 | |
| 
 | |
|     check-cast p1, Ljava/lang/String;
 | |
| 
 | |
|     invoke-virtual {p1}, Ljava/lang/String;->getBytes()[B
 | |
| 
 | |
|     move-result-object p1
 | |
| 
 | |
|     goto :goto_0
 | |
| 
 | |
|     :cond_0
 | |
|     check-cast p1, [B
 | |
| 
 | |
|     .line 3
 | |
|     :goto_0
 | |
|     invoke-static {p1}, Lorg/apache/commons/codec/binary/Hex;->encodeHex([B)[C
 | |
| 
 | |
|     move-result-object p1
 | |
|     :try_end_0
 | |
|     .catch Ljava/lang/ClassCastException; {:try_start_0 .. :try_end_0} :catch_0
 | |
| 
 | |
|     return-object p1
 | |
| 
 | |
|     :catch_0
 | |
|     move-exception p1
 | |
| 
 | |
|     .line 4
 | |
|     new-instance v0, Lorg/apache/commons/codec/EncoderException;
 | |
| 
 | |
|     invoke-virtual {p1}, Ljava/lang/ClassCastException;->getMessage()Ljava/lang/String;
 | |
| 
 | |
|     move-result-object p1
 | |
| 
 | |
|     invoke-direct {v0, p1}, Lorg/apache/commons/codec/EncoderException;-><init>(Ljava/lang/String;)V
 | |
| 
 | |
|     throw v0
 | |
| .end method
 | |
| 
 | |
| .method public encode([B)[B
 | |
|     .locals 1
 | |
| 
 | |
|     .line 1
 | |
|     new-instance v0, Ljava/lang/String;
 | |
| 
 | |
|     invoke-static {p1}, Lorg/apache/commons/codec/binary/Hex;->encodeHex([B)[C
 | |
| 
 | |
|     move-result-object p1
 | |
| 
 | |
|     invoke-direct {v0, p1}, Ljava/lang/String;-><init>([C)V
 | |
| 
 | |
|     invoke-virtual {v0}, Ljava/lang/String;->getBytes()[B
 | |
| 
 | |
|     move-result-object p1
 | |
| 
 | |
|     return-object p1
 | |
| .end method
 |