a.smali

.class public Lcom/kwad/sdk/c/a;
.super Ljava/lang/Object;


# direct methods
.method public static a(Ljava/io/Closeable;)V
    .registers 2

    if-eqz p0, :cond_5

    :try_start_2
    invoke-interface {p0}, Ljava/io/Closeable;->close()V
    :try_end_5
    .catch Ljava/io/IOException; {:try_start_2 .. :try_end_5} :catch_6

    :cond_5
    :goto_5
    return-void

    :catch_6
    move-exception v0

    goto :goto_5
.end method

.method public static a(Ljava/io/File;)[B
    .registers 7
    .annotation build Landroid/support/annotation/Nullable;
    .end annotation

    .annotation build Landroid/support/annotation/WorkerThread;
    .end annotation

    const/4 v0, 0x0

    if-nez p0, :cond_4

    :goto_3
    return-object v0

    :cond_4
    new-instance v2, Ljava/io/FileInputStream;

    invoke-direct {v2, p0}, Ljava/io/FileInputStream;-><init>(Ljava/io/File;)V

    :try_start_9
    const-string v1, "MD5"

    invoke-static {v1}, Ljava/security/MessageDigest;->getInstance(Ljava/lang/String;)Ljava/security/MessageDigest;

    move-result-object v1

    const/16 v3, 0x1000

    new-array v3, v3, [B

    :goto_13
    invoke-virtual {v2, v3}, Ljava/io/FileInputStream;->read([B)I

    move-result v4

    const/4 v5, -0x1

    if-eq v4, v5, :cond_2b

    const/4 v5, 0x0

    invoke-virtual {v1, v3, v5, v4}, Ljava/security/MessageDigest;->update([BII)V
    :try_end_1e
    .catch Ljava/lang/Exception; {:try_start_9 .. :try_end_1e} :catch_1f
    .catchall {:try_start_9 .. :try_end_1e} :catchall_33

    goto :goto_13

    :catch_1f
    move-exception v1

    :try_start_20
    const-string v3, "FileMD5Utils"

    const-string v4, "getting file md5 digest error."

    invoke-static {v3, v4, v1}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I
    :try_end_27
    .catchall {:try_start_20 .. :try_end_27} :catchall_33

    invoke-static {v2}, Lcom/kwad/sdk/c/a;->a(Ljava/io/Closeable;)V

    goto :goto_3

    :cond_2b
    :try_start_2b
    invoke-virtual {v1}, Ljava/security/MessageDigest;->digest()[B
    :try_end_2e
    .catch Ljava/lang/Exception; {:try_start_2b .. :try_end_2e} :catch_1f
    .catchall {:try_start_2b .. :try_end_2e} :catchall_33

    move-result-object v0

    invoke-static {v2}, Lcom/kwad/sdk/c/a;->a(Ljava/io/Closeable;)V

    goto :goto_3

    :catchall_33
    move-exception v0

    invoke-static {v2}, Lcom/kwad/sdk/c/a;->a(Ljava/io/Closeable;)V

    throw v0
.end method

.method public static b(Ljava/io/File;)Ljava/lang/String;
    .registers 5
    .annotation build Landroid/support/annotation/Nullable;
    .end annotation

    .annotation build Landroid/support/annotation/WorkerThread;
    .end annotation

    const/4 v1, 0x0

    :try_start_1
    invoke-static {p0}, Lcom/kwad/sdk/c/a;->a(Ljava/io/File;)[B

    move-result-object v0

    if-eqz v0, :cond_a

    array-length v2, v0

    if-nez v2, :cond_c

    :cond_a
    move-object v0, v1

    :goto_b
    return-object v0

    :cond_c
    const/4 v2, 0x0

    array-length v3, v0

    invoke-static {v0, v2, v3}, Lcom/kwad/sdk/c/m;->a([BII)Ljava/lang/String;
    :try_end_11
    .catch Ljava/security/NoSuchAlgorithmException; {:try_start_1 .. :try_end_11} :catch_13
    .catch Ljava/io/IOException; {:try_start_1 .. :try_end_11} :catch_1d

    move-result-object v0

    goto :goto_b

    :catch_13
    move-exception v0

    :goto_14
    const-string v2, "FileMD5Utils"

    const-string v3, "cannot calculate md5 of file"

    invoke-static {v2, v3, v0}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I

    move-object v0, v1

    goto :goto_b

    :catch_1d
    move-exception v0

    goto :goto_14
.end method