BlowfishCrypt.smali
.class public Lsg/bigo/svcapi/util/BlowfishCrypt;
.super Ljava/lang/Object;
.source "SourceFile"
# static fields
.field private static final BLOWFISH:Ljava/lang/String; = "Blowfish"
.field private static final TAG:Ljava/lang/String; = "BlowfishCrypt"
.field private static final TRANSFORMATION:Ljava/lang/String; = "Blowfish/CBC/NoPadding"
# direct methods
.method public constructor <init>()V
.registers 1
.line 11
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
return-void
.end method
.method public static decrypt(Ljava/lang/String;[B[B)[B
.registers 5
.line 37
:try_start_0
new-instance v0, Ljavax/crypto/spec/SecretKeySpec;
invoke-virtual {p0}, Ljava/lang/String;->getBytes()[B
move-result-object p0
const-string v1, "Blowfish"
invoke-direct {v0, p0, v1}, Ljavax/crypto/spec/SecretKeySpec;-><init>([BLjava/lang/String;)V
.line 38
new-instance p0, Ljavax/crypto/spec/IvParameterSpec;
invoke-direct {p0, p1}, Ljavax/crypto/spec/IvParameterSpec;-><init>([B)V
const-string p1, "Blowfish/CBC/NoPadding"
.line 39
invoke-static {p1}, Ljavax/crypto/Cipher;->getInstance(Ljava/lang/String;)Ljavax/crypto/Cipher;
move-result-object p1
const/4 v1, 0x2
.line 40
invoke-virtual {p1, v1, v0, p0}, Ljavax/crypto/Cipher;->init(ILjava/security/Key;Ljava/security/spec/AlgorithmParameterSpec;)V
.line 41
invoke-virtual {p1, p2}, Ljavax/crypto/Cipher;->doFinal([B)[B
move-result-object p0
:try_end_1e
.catch Ljava/lang/Exception; {:try_start_0 .. :try_end_1e} :catch_1f
goto :goto_28
:catch_1f
move-exception p0
const-string p1, "BlowfishCrypt"
const-string p2, "decrypt failed"
.line 43
invoke-static {p1, p2, p0}, Lsg/bigo/log/Log;->w(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I
const/4 p0, 0x0
:goto_28
return-object p0
.end method
.method public static encrypt(Ljava/lang/String;[B[B)[B
.registers 5
.line 21
:try_start_0
new-instance v0, Ljavax/crypto/spec/SecretKeySpec;
invoke-virtual {p0}, Ljava/lang/String;->getBytes()[B
move-result-object p0
const-string v1, "Blowfish"
invoke-direct {v0, p0, v1}, Ljavax/crypto/spec/SecretKeySpec;-><init>([BLjava/lang/String;)V
.line 22
new-instance p0, Ljavax/crypto/spec/IvParameterSpec;
invoke-direct {p0, p1}, Ljavax/crypto/spec/IvParameterSpec;-><init>([B)V
const-string p1, "Blowfish/CBC/NoPadding"
.line 23
invoke-static {p1}, Ljavax/crypto/Cipher;->getInstance(Ljava/lang/String;)Ljavax/crypto/Cipher;
move-result-object p1
const/4 v1, 0x1
.line 24
invoke-virtual {p1, v1, v0, p0}, Ljavax/crypto/Cipher;->init(ILjava/security/Key;Ljava/security/spec/AlgorithmParameterSpec;)V
.line 25
invoke-virtual {p1, p2}, Ljavax/crypto/Cipher;->doFinal([B)[B
move-result-object p0
:try_end_1e
.catch Ljava/lang/Exception; {:try_start_0 .. :try_end_1e} :catch_1f
goto :goto_28
:catch_1f
move-exception p0
const-string p1, "BlowfishCrypt"
const-string p2, "encrypt failed"
.line 27
invoke-static {p1, p2, p0}, Lsg/bigo/log/Log;->w(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I
const/4 p0, 0x0
:goto_28
return-object p0
.end method