SecureRandomUtils.smali

.class final Lorg/web3j/crypto/SecureRandomUtils;
.super Ljava/lang/Object;
.source "SecureRandomUtils.java"


# static fields
.field private static final SECURE_RANDOM:Ljava/security/SecureRandom;

.field private static isAndroid:I


# direct methods
.method static constructor <clinit>()V
    .registers 1

    .prologue
    .line 16
    invoke-static {}, Lorg/web3j/crypto/SecureRandomUtils;->isAndroidRuntime()Z

    move-result v0

    if-eqz v0, :cond_b

    .line 17
    new-instance v0, Lorg/web3j/crypto/LinuxSecureRandom;

    invoke-direct {v0}, Lorg/web3j/crypto/LinuxSecureRandom;-><init>()V

    .line 19
    :cond_b
    new-instance v0, Ljava/security/SecureRandom;

    invoke-direct {v0}, Ljava/security/SecureRandom;-><init>()V

    sput-object v0, Lorg/web3j/crypto/SecureRandomUtils;->SECURE_RANDOM:Ljava/security/SecureRandom;

    .line 28
    const/4 v0, -0x1

    sput v0, Lorg/web3j/crypto/SecureRandomUtils;->isAndroid:I

    return-void
.end method

.method private constructor <init>()V
    .registers 1

    .prologue
    .line 38
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    return-void
.end method

.method static isAndroidRuntime()Z
    .registers 4

    .prologue
    const/4 v2, 0x0

    const/4 v1, 0x1

    .line 31
    sget v0, Lorg/web3j/crypto/SecureRandomUtils;->isAndroid:I

    const/4 v3, -0x1

    if-ne v0, v3, :cond_1a

    .line 32
    const-string v0, "java.runtime.name"

    invoke-static {v0}, Ljava/lang/System;->getProperty(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v0

    .line 33
    if-eqz v0, :cond_1f

    const-string v3, "Android Runtime"

    invoke-virtual {v0, v3}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v0

    if-eqz v0, :cond_1f

    move v0, v1

    :goto_18
    sput v0, Lorg/web3j/crypto/SecureRandomUtils;->isAndroid:I

    .line 35
    :cond_1a
    sget v0, Lorg/web3j/crypto/SecureRandomUtils;->isAndroid:I

    if-ne v0, v1, :cond_21

    :goto_1e
    return v1

    :cond_1f
    move v0, v2

    .line 33
    goto :goto_18

    :cond_21
    move v1, v2

    .line 35
    goto :goto_1e
.end method

.method static secureRandom()Ljava/security/SecureRandom;
    .registers 1

    .prologue
    .line 23
    sget-object v0, Lorg/web3j/crypto/SecureRandomUtils;->SECURE_RANDOM:Ljava/security/SecureRandom;

    return-object v0
.end method