q.smali
.class public final Lcom/subgraph/orchid/crypto/q;
.super Ljava/lang/Object;
.source "TorRandom.java"
# instance fields
.field private final random:Ljava/security/SecureRandom;
# direct methods
.method public constructor <init>()V
.registers 2
.prologue
.line 12
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
.line 13
invoke-static {}, Lcom/subgraph/orchid/crypto/q;->Mk()Ljava/security/SecureRandom;
move-result-object v0
iput-object v0, p0, Lcom/subgraph/orchid/crypto/q;->random:Ljava/security/SecureRandom;
.line 14
return-void
.end method
.method private static Mk()Ljava/security/SecureRandom;
.registers 2
.prologue
.line 18
:try_start_0
const-string v0, "SHA1PRNG"
invoke-static {v0}, Ljava/security/SecureRandom;->getInstance(Ljava/lang/String;)Ljava/security/SecureRandom;
:try_end_5
.catch Ljava/security/NoSuchAlgorithmException; {:try_start_0 .. :try_end_5} :catch_7
move-result-object v0
return-object v0
.line 19
:catch_7
move-exception v0
.line 20
new-instance v1, Lcom/subgraph/orchid/TorException;
invoke-direct {v1, v0}, Lcom/subgraph/orchid/TorException;-><init>(Ljava/lang/Throwable;)V
throw v1
.end method
# virtual methods
.method public final getBytes(I)[B
.registers 4
.prologue
.line 25
new-array v0, p1, [B
.line 26
iget-object v1, p0, Lcom/subgraph/orchid/crypto/q;->random:Ljava/security/SecureRandom;
invoke-virtual {v1, v0}, Ljava/security/SecureRandom;->nextBytes([B)V
.line 27
return-object v0
.end method
.method public final nextInt(I)I
.registers 3
.prologue
.line 40
iget-object v0, p0, Lcom/subgraph/orchid/crypto/q;->random:Ljava/security/SecureRandom;
invoke-virtual {v0, p1}, Ljava/security/SecureRandom;->nextInt(I)I
move-result v0
return v0
.end method
.method public final nextLong()J
.registers 5
.prologue
.line 53
iget-object v0, p0, Lcom/subgraph/orchid/crypto/q;->random:Ljava/security/SecureRandom;
invoke-virtual {v0}, Ljava/security/SecureRandom;->nextLong()J
move-result-wide v0
const-wide v2, 0x7fffffffffffffffL
and-long/2addr v0, v2
return-wide v0
.end method
.method public final nextLong(J)J
.registers 10
.prologue
.line 33
:cond_0
invoke-virtual {p0}, Lcom/subgraph/orchid/crypto/q;->nextLong()J
move-result-wide v0
.line 34
rem-long v2, v0, p1
.line 35
sub-long/2addr v0, v2
const-wide/16 v4, 0x1
sub-long v4, p1, v4
add-long/2addr v0, v4
const-wide/16 v4, 0x0
cmp-long v0, v0, v4
if-ltz v0, :cond_0
.line 36
return-wide v2
.end method