ThreefishEngine.smali
.class public Lorg/spongycastle/crypto/engines/ThreefishEngine;
.super Ljava/lang/Object;
.source "ThreefishEngine.java"
# interfaces
.implements Lorg/spongycastle/crypto/BlockCipher;
# static fields
.field public static final BLOCKSIZE_1024:I = 0x400
.field public static final BLOCKSIZE_256:I = 0x100
.field public static final BLOCKSIZE_512:I = 0x200
.field private static final C_240:J = 0x1bd11bdaa9fc1a22L
.field private static final MAX_ROUNDS:I = 0x50
.field private static MOD17:[I = null
.field private static MOD3:[I = null
.field private static MOD5:[I = null
.field private static MOD9:[I = null
.field private static final ROUNDS_1024:I = 0x50
.field private static final ROUNDS_256:I = 0x48
.field private static final ROUNDS_512:I = 0x48
.field private static final TWEAK_SIZE_BYTES:I = 0x10
.field private static final TWEAK_SIZE_WORDS:I = 0x2
# instance fields
.field private blocksizeBytes:I
.field private blocksizeWords:I
.field private cipher:Lorg/spongycastle/crypto/engines/ThreefishEngine$ThreefishCipher;
.field private currentBlock:[J
.field private forEncryption:Z
.field private kw:[J
.field private t:[J
# direct methods
.method static constructor <clinit>()V
.registers 3
.prologue
const/16 v1, 0x50
.line 69
new-array v0, v1, [I
.line 70
sput-object v0, Lorg/spongycastle/crypto/engines/ThreefishEngine;->MOD9:[I
new-array v0, v1, [I
sput-object v0, Lorg/spongycastle/crypto/engines/ThreefishEngine;->MOD17:[I
.line 71
sget-object v0, Lorg/spongycastle/crypto/engines/ThreefishEngine;->MOD9:[I
array-length v0, v0
new-array v0, v0, [I
sput-object v0, Lorg/spongycastle/crypto/engines/ThreefishEngine;->MOD5:[I
.line 72
sget-object v0, Lorg/spongycastle/crypto/engines/ThreefishEngine;->MOD9:[I
array-length v0, v0
new-array v0, v0, [I
sput-object v0, Lorg/spongycastle/crypto/engines/ThreefishEngine;->MOD3:[I
.line 76
const/4 v0, 0x0
:goto_19
sget-object v1, Lorg/spongycastle/crypto/engines/ThreefishEngine;->MOD9:[I
array-length v1, v1
if-ge v0, v1, :cond_39
.line 78
sget-object v1, Lorg/spongycastle/crypto/engines/ThreefishEngine;->MOD17:[I
rem-int/lit8 v2, v0, 0x11
aput v2, v1, v0
.line 79
sget-object v1, Lorg/spongycastle/crypto/engines/ThreefishEngine;->MOD9:[I
rem-int/lit8 v2, v0, 0x9
aput v2, v1, v0
.line 80
sget-object v1, Lorg/spongycastle/crypto/engines/ThreefishEngine;->MOD5:[I
rem-int/lit8 v2, v0, 0x5
aput v2, v1, v0
.line 81
sget-object v1, Lorg/spongycastle/crypto/engines/ThreefishEngine;->MOD3:[I
rem-int/lit8 v2, v0, 0x3
aput v2, v1, v0
.line 76
add-int/lit8 v0, v0, 0x1
goto :goto_19
.line 83
:cond_39
return-void
.end method
.method public constructor <init>(I)V
.registers 5
.prologue
.line 124
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
.line 103
const/4 v0, 0x5
new-array v0, v0, [J
iput-object v0, p0, Lorg/spongycastle/crypto/engines/ThreefishEngine;->t:[J
.line 125
div-int/lit8 v0, p1, 0x8
iput v0, p0, Lorg/spongycastle/crypto/engines/ThreefishEngine;->blocksizeBytes:I
.line 126
iget v0, p0, Lorg/spongycastle/crypto/engines/ThreefishEngine;->blocksizeBytes:I
div-int/lit8 v0, v0, 0x8
iput v0, p0, Lorg/spongycastle/crypto/engines/ThreefishEngine;->blocksizeWords:I
.line 127
iget v0, p0, Lorg/spongycastle/crypto/engines/ThreefishEngine;->blocksizeWords:I
new-array v0, v0, [J
iput-object v0, p0, Lorg/spongycastle/crypto/engines/ThreefishEngine;->currentBlock:[J
.line 133
iget v0, p0, Lorg/spongycastle/crypto/engines/ThreefishEngine;->blocksizeWords:I
mul-int/lit8 v0, v0, 0x2
add-int/lit8 v0, v0, 0x1
new-array v0, v0, [J
iput-object v0, p0, Lorg/spongycastle/crypto/engines/ThreefishEngine;->kw:[J
.line 135
sparse-switch p1, :sswitch_data_52
.line 147
new-instance v0, Ljava/lang/IllegalArgumentException;
const-string v1, "Invalid blocksize - Threefish is defined with block size of 256, 512, or 1024 bits"
invoke-direct {v0, v1}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
throw v0
.line 138
:sswitch_2d
new-instance v0, Lorg/spongycastle/crypto/engines/ThreefishEngine$Threefish256Cipher;
iget-object v1, p0, Lorg/spongycastle/crypto/engines/ThreefishEngine;->kw:[J
iget-object v2, p0, Lorg/spongycastle/crypto/engines/ThreefishEngine;->t:[J
invoke-direct {v0, v1, v2}, Lorg/spongycastle/crypto/engines/ThreefishEngine$Threefish256Cipher;-><init>([J[J)V
iput-object v0, p0, Lorg/spongycastle/crypto/engines/ThreefishEngine;->cipher:Lorg/spongycastle/crypto/engines/ThreefishEngine$ThreefishCipher;
.line 145
:goto_38
return-void
.line 141
:sswitch_39
new-instance v0, Lorg/spongycastle/crypto/engines/ThreefishEngine$Threefish512Cipher;
iget-object v1, p0, Lorg/spongycastle/crypto/engines/ThreefishEngine;->kw:[J
iget-object v2, p0, Lorg/spongycastle/crypto/engines/ThreefishEngine;->t:[J
invoke-direct {v0, v1, v2}, Lorg/spongycastle/crypto/engines/ThreefishEngine$Threefish512Cipher;-><init>([J[J)V
iput-object v0, p0, Lorg/spongycastle/crypto/engines/ThreefishEngine;->cipher:Lorg/spongycastle/crypto/engines/ThreefishEngine$ThreefishCipher;
goto :goto_38
.line 144
:sswitch_45
new-instance v0, Lorg/spongycastle/crypto/engines/ThreefishEngine$Threefish1024Cipher;
iget-object v1, p0, Lorg/spongycastle/crypto/engines/ThreefishEngine;->kw:[J
iget-object v2, p0, Lorg/spongycastle/crypto/engines/ThreefishEngine;->t:[J
invoke-direct {v0, v1, v2}, Lorg/spongycastle/crypto/engines/ThreefishEngine$Threefish1024Cipher;-><init>([J[J)V
iput-object v0, p0, Lorg/spongycastle/crypto/engines/ThreefishEngine;->cipher:Lorg/spongycastle/crypto/engines/ThreefishEngine$ThreefishCipher;
goto :goto_38
.line 135
nop
:sswitch_data_52
.sparse-switch
0x100 -> :sswitch_2d
0x200 -> :sswitch_39
0x400 -> :sswitch_45
.end sparse-switch
.end method
.method static synthetic access$000()[I
.registers 1
.prologue
.line 23
sget-object v0, Lorg/spongycastle/crypto/engines/ThreefishEngine;->MOD5:[I
return-object v0
.end method
.method static synthetic access$100()[I
.registers 1
.prologue
.line 23
sget-object v0, Lorg/spongycastle/crypto/engines/ThreefishEngine;->MOD3:[I
return-object v0
.end method
.method static synthetic access$200()[I
.registers 1
.prologue
.line 23
sget-object v0, Lorg/spongycastle/crypto/engines/ThreefishEngine;->MOD9:[I
return-object v0
.end method
.method static synthetic access$300()[I
.registers 1
.prologue
.line 23
sget-object v0, Lorg/spongycastle/crypto/engines/ThreefishEngine;->MOD17:[I
return-object v0
.end method
.method public static bytesToWord([BI)J
.registers 10
.prologue
const-wide/16 v6, 0xff
.line 356
add-int/lit8 v0, p1, 0x8
array-length v1, p0
if-le v0, v1, :cond_d
.line 359
new-instance v0, Ljava/lang/IllegalArgumentException;
invoke-direct {v0}, Ljava/lang/IllegalArgumentException;-><init>()V
throw v0
.line 365
:cond_d
add-int/lit8 v0, p1, 0x1
aget-byte v1, p0, p1
int-to-long v2, v1
and-long/2addr v2, v6
.line 366
add-int/lit8 v1, v0, 0x1
aget-byte v0, p0, v0
int-to-long v4, v0
and-long/2addr v4, v6
const/16 v0, 0x8
shl-long/2addr v4, v0
or-long/2addr v2, v4
.line 367
add-int/lit8 v0, v1, 0x1
aget-byte v1, p0, v1
int-to-long v4, v1
and-long/2addr v4, v6
const/16 v1, 0x10
shl-long/2addr v4, v1
or-long/2addr v2, v4
.line 368
add-int/lit8 v1, v0, 0x1
aget-byte v0, p0, v0
int-to-long v4, v0
and-long/2addr v4, v6
const/16 v0, 0x18
shl-long/2addr v4, v0
or-long/2addr v2, v4
.line 369
add-int/lit8 v0, v1, 0x1
aget-byte v1, p0, v1
int-to-long v4, v1
and-long/2addr v4, v6
const/16 v1, 0x20
shl-long/2addr v4, v1
or-long/2addr v2, v4
.line 370
add-int/lit8 v1, v0, 0x1
aget-byte v0, p0, v0
int-to-long v4, v0
and-long/2addr v4, v6
const/16 v0, 0x28
shl-long/2addr v4, v0
or-long/2addr v2, v4
.line 371
add-int/lit8 v0, v1, 0x1
aget-byte v1, p0, v1
int-to-long v4, v1
and-long/2addr v4, v6
const/16 v1, 0x30
shl-long/2addr v4, v1
or-long/2addr v2, v4
.line 372
aget-byte v0, p0, v0
int-to-long v0, v0
and-long/2addr v0, v6
const/16 v4, 0x38
shl-long/2addr v0, v4
or-long/2addr v0, v2
.line 374
return-wide v0
.end method
.method static rotlXor(JIJ)J
.registers 9
.prologue
.line 406
shl-long v0, p0, p2
neg-int v2, p2
ushr-long v2, p0, v2
or-long/2addr v0, v2
xor-long/2addr v0, p3
return-wide v0
.end method
.method private setKey([J)V
.registers 10
.prologue
const/4 v1, 0x0
.line 230
array-length v0, p1
iget v2, p0, Lorg/spongycastle/crypto/engines/ThreefishEngine;->blocksizeWords:I
if-eq v0, v2, :cond_23
.line 232
new-instance v0, Ljava/lang/IllegalArgumentException;
new-instance v1, Ljava/lang/StringBuilder;
const-string v2, "Threefish key must be same size as block ("
invoke-direct {v1, v2}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V
iget v2, p0, Lorg/spongycastle/crypto/engines/ThreefishEngine;->blocksizeWords:I
invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;
move-result-object v1
const-string v2, " words)"
invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v1
invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object v1
invoke-direct {v0, v1}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
throw v0
.line 244
:cond_23
const-wide v2, 0x1bd11bdaa9fc1a22L # 1.080841987832705E-174
move v0, v1
.line 245
:goto_29
iget v4, p0, Lorg/spongycastle/crypto/engines/ThreefishEngine;->blocksizeWords:I
if-ge v0, v4, :cond_3b
.line 247
iget-object v4, p0, Lorg/spongycastle/crypto/engines/ThreefishEngine;->kw:[J
aget-wide v6, p1, v0
aput-wide v6, v4, v0
.line 248
iget-object v4, p0, Lorg/spongycastle/crypto/engines/ThreefishEngine;->kw:[J
aget-wide v4, v4, v0
xor-long/2addr v2, v4
.line 245
add-int/lit8 v0, v0, 0x1
goto :goto_29
.line 250
:cond_3b
iget-object v0, p0, Lorg/spongycastle/crypto/engines/ThreefishEngine;->kw:[J
iget v4, p0, Lorg/spongycastle/crypto/engines/ThreefishEngine;->blocksizeWords:I
aput-wide v2, v0, v4
.line 251
iget-object v0, p0, Lorg/spongycastle/crypto/engines/ThreefishEngine;->kw:[J
iget-object v2, p0, Lorg/spongycastle/crypto/engines/ThreefishEngine;->kw:[J
iget v3, p0, Lorg/spongycastle/crypto/engines/ThreefishEngine;->blocksizeWords:I
add-int/lit8 v3, v3, 0x1
iget v4, p0, Lorg/spongycastle/crypto/engines/ThreefishEngine;->blocksizeWords:I
invoke-static {v0, v1, v2, v3, v4}, Ljava/lang/System;->arraycopy(Ljava/lang/Object;ILjava/lang/Object;II)V
.line 252
return-void
.end method
.method private setTweak([J)V
.registers 11
.prologue
const/4 v8, 0x2
const/4 v7, 0x1
const/4 v6, 0x0
.line 256
array-length v0, p1
if-eq v0, v8, :cond_e
.line 258
new-instance v0, Ljava/lang/IllegalArgumentException;
const-string v1, "Tweak must be 2 words."
invoke-direct {v0, v1}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
throw v0
.line 264
:cond_e
iget-object v0, p0, Lorg/spongycastle/crypto/engines/ThreefishEngine;->t:[J
aget-wide v2, p1, v6
aput-wide v2, v0, v6
.line 265
iget-object v0, p0, Lorg/spongycastle/crypto/engines/ThreefishEngine;->t:[J
aget-wide v2, p1, v7
aput-wide v2, v0, v7
.line 266
iget-object v0, p0, Lorg/spongycastle/crypto/engines/ThreefishEngine;->t:[J
iget-object v1, p0, Lorg/spongycastle/crypto/engines/ThreefishEngine;->t:[J
aget-wide v2, v1, v6
iget-object v1, p0, Lorg/spongycastle/crypto/engines/ThreefishEngine;->t:[J
aget-wide v4, v1, v7
xor-long/2addr v2, v4
aput-wide v2, v0, v8
.line 267
iget-object v0, p0, Lorg/spongycastle/crypto/engines/ThreefishEngine;->t:[J
const/4 v1, 0x3
iget-object v2, p0, Lorg/spongycastle/crypto/engines/ThreefishEngine;->t:[J
aget-wide v2, v2, v6
aput-wide v2, v0, v1
.line 268
iget-object v0, p0, Lorg/spongycastle/crypto/engines/ThreefishEngine;->t:[J
const/4 v1, 0x4
iget-object v2, p0, Lorg/spongycastle/crypto/engines/ThreefishEngine;->t:[J
aget-wide v2, v2, v7
aput-wide v2, v0, v1
.line 269
return-void
.end method
.method public static wordToBytes(J[BI)V
.registers 8
.prologue
.line 383
add-int/lit8 v0, p3, 0x8
array-length v1, p2
if-le v0, v1, :cond_b
.line 386
new-instance v0, Ljava/lang/IllegalArgumentException;
invoke-direct {v0}, Ljava/lang/IllegalArgumentException;-><init>()V
throw v0
.line 390
:cond_b
add-int/lit8 v0, p3, 0x1
long-to-int v1, p0
int-to-byte v1, v1
aput-byte v1, p2, p3
.line 391
add-int/lit8 v1, v0, 0x1
const/16 v2, 0x8
shr-long v2, p0, v2
long-to-int v2, v2
int-to-byte v2, v2
aput-byte v2, p2, v0
.line 392
add-int/lit8 v0, v1, 0x1
const/16 v2, 0x10
shr-long v2, p0, v2
long-to-int v2, v2
int-to-byte v2, v2
aput-byte v2, p2, v1
.line 393
add-int/lit8 v1, v0, 0x1
const/16 v2, 0x18
shr-long v2, p0, v2
long-to-int v2, v2
int-to-byte v2, v2
aput-byte v2, p2, v0
.line 394
add-int/lit8 v0, v1, 0x1
const/16 v2, 0x20
shr-long v2, p0, v2
long-to-int v2, v2
int-to-byte v2, v2
aput-byte v2, p2, v1
.line 395
add-int/lit8 v1, v0, 0x1
const/16 v2, 0x28
shr-long v2, p0, v2
long-to-int v2, v2
int-to-byte v2, v2
aput-byte v2, p2, v0
.line 396
add-int/lit8 v0, v1, 0x1
const/16 v2, 0x30
shr-long v2, p0, v2
long-to-int v2, v2
int-to-byte v2, v2
aput-byte v2, p2, v1
.line 397
const/16 v1, 0x38
shr-long v2, p0, v1
long-to-int v1, v2
int-to-byte v1, v1
aput-byte v1, p2, v0
.line 398
return-void
.end method
.method static xorRotr(JIJ)J
.registers 10
.prologue
.line 415
xor-long v0, p0, p3
.line 416
ushr-long v2, v0, p2
neg-int v4, p2
shl-long/2addr v0, v4
or-long/2addr v0, v2
return-wide v0
.end method
# virtual methods
.method public getAlgorithmName()Ljava/lang/String;
.registers 3
.prologue
.line 273
new-instance v0, Ljava/lang/StringBuilder;
const-string v1, "Threefish-"
invoke-direct {v0, v1}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V
iget v1, p0, Lorg/spongycastle/crypto/engines/ThreefishEngine;->blocksizeBytes:I
shl-int/lit8 v1, v1, 0x3
invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;
move-result-object v0
invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object v0
return-object v0
.end method
.method public getBlockSize()I
.registers 2
.prologue
.line 278
iget v0, p0, Lorg/spongycastle/crypto/engines/ThreefishEngine;->blocksizeBytes:I
return v0
.end method
.method public init(ZLorg/spongycastle/crypto/CipherParameters;)V
.registers 11
.prologue
const/4 v2, 0x0
const/4 v1, 0x0
.line 164
instance-of v0, p2, Lorg/spongycastle/crypto/params/TweakableBlockCipherParameters;
if-eqz v0, :cond_3a
.line 166
check-cast p2, Lorg/spongycastle/crypto/params/TweakableBlockCipherParameters;
.line 167
invoke-virtual {p2}, Lorg/spongycastle/crypto/params/TweakableBlockCipherParameters;->getKey()Lorg/spongycastle/crypto/params/KeyParameter;
move-result-object v0
invoke-virtual {v0}, Lorg/spongycastle/crypto/params/KeyParameter;->getKey()[B
move-result-object v3
.line 168
invoke-virtual {p2}, Lorg/spongycastle/crypto/params/TweakableBlockCipherParameters;->getTweak()[B
move-result-object v0
move-object v4, v0
move-object v5, v3
.line 184
:goto_16
if-eqz v5, :cond_77
.line 186
array-length v0, v5
iget v3, p0, Lorg/spongycastle/crypto/engines/ThreefishEngine;->blocksizeBytes:I
if-eq v0, v3, :cond_64
.line 188
new-instance v0, Ljava/lang/IllegalArgumentException;
new-instance v1, Ljava/lang/StringBuilder;
const-string v2, "Threefish key must be same size as block ("
invoke-direct {v1, v2}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V
iget v2, p0, Lorg/spongycastle/crypto/engines/ThreefishEngine;->blocksizeBytes:I
invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;
move-result-object v1
const-string v2, " bytes)"
invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v1
invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object v1
invoke-direct {v0, v1}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
throw v0
.line 170
:cond_3a
instance-of v0, p2, Lorg/spongycastle/crypto/params/KeyParameter;
if-eqz v0, :cond_47
.line 172
check-cast p2, Lorg/spongycastle/crypto/params/KeyParameter;
invoke-virtual {p2}, Lorg/spongycastle/crypto/params/KeyParameter;->getKey()[B
move-result-object v0
move-object v4, v2
move-object v5, v0
.line 173
goto :goto_16
.line 177
:cond_47
new-instance v0, Ljava/lang/IllegalArgumentException;
new-instance v1, Ljava/lang/StringBuilder;
const-string v2, "Invalid parameter passed to Threefish init - "
invoke-direct {v1, v2}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V
.line 178
invoke-virtual {p2}, Ljava/lang/Object;->getClass()Ljava/lang/Class;
move-result-object v2
invoke-virtual {v2}, Ljava/lang/Class;->getName()Ljava/lang/String;
move-result-object v2
invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v1
invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object v1
invoke-direct {v0, v1}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
throw v0
.line 191
:cond_64
iget v0, p0, Lorg/spongycastle/crypto/engines/ThreefishEngine;->blocksizeWords:I
new-array v3, v0, [J
move v0, v1
.line 192
:goto_69
array-length v6, v3
if-ge v0, v6, :cond_78
.line 194
shl-int/lit8 v6, v0, 0x3
invoke-static {v5, v6}, Lorg/spongycastle/crypto/engines/ThreefishEngine;->bytesToWord([BI)J
move-result-wide v6
aput-wide v6, v3, v0
.line 192
add-int/lit8 v0, v0, 0x1
goto :goto_69
:cond_77
move-object v3, v2
.line 197
:cond_78
if-eqz v4, :cond_9d
.line 199
array-length v0, v4
const/16 v2, 0x10
if-eq v0, v2, :cond_87
.line 201
new-instance v0, Ljava/lang/IllegalArgumentException;
const-string v1, "Threefish tweak must be 16 bytes"
invoke-direct {v0, v1}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
throw v0
.line 203
:cond_87
const/4 v0, 0x2
new-array v0, v0, [J
invoke-static {v4, v1}, Lorg/spongycastle/crypto/engines/ThreefishEngine;->bytesToWord([BI)J
move-result-wide v6
aput-wide v6, v0, v1
const/4 v1, 0x1
const/16 v2, 0x8
invoke-static {v4, v2}, Lorg/spongycastle/crypto/engines/ThreefishEngine;->bytesToWord([BI)J
move-result-wide v4
aput-wide v4, v0, v1
.line 205
:goto_99
invoke-virtual {p0, p1, v3, v0}, Lorg/spongycastle/crypto/engines/ThreefishEngine;->init(Z[J[J)V
.line 206
return-void
:cond_9d
move-object v0, v2
goto :goto_99
.end method
.method public init(Z[J[J)V
.registers 4
.prologue
.line 217
iput-boolean p1, p0, Lorg/spongycastle/crypto/engines/ThreefishEngine;->forEncryption:Z
.line 218
if-eqz p2, :cond_7
.line 220
invoke-direct {p0, p2}, Lorg/spongycastle/crypto/engines/ThreefishEngine;->setKey([J)V
.line 222
:cond_7
if-eqz p3, :cond_c
.line 224
invoke-direct {p0, p3}, Lorg/spongycastle/crypto/engines/ThreefishEngine;->setTweak([J)V
.line 226
:cond_c
return-void
.end method
.method public processBlock([BI[BI)I
.registers 11
.prologue
const/4 v1, 0x0
.line 289
iget v0, p0, Lorg/spongycastle/crypto/engines/ThreefishEngine;->blocksizeBytes:I
add-int/2addr v0, p4
array-length v2, p3
if-le v0, v2, :cond_f
.line 291
new-instance v0, Lorg/spongycastle/crypto/DataLengthException;
const-string v1, "Output buffer too short"
invoke-direct {v0, v1}, Lorg/spongycastle/crypto/DataLengthException;-><init>(Ljava/lang/String;)V
throw v0
.line 294
:cond_f
iget v0, p0, Lorg/spongycastle/crypto/engines/ThreefishEngine;->blocksizeBytes:I
add-int/2addr v0, p2
array-length v2, p1
if-le v0, v2, :cond_1d
.line 296
new-instance v0, Lorg/spongycastle/crypto/DataLengthException;
const-string v1, "Input buffer too short"
invoke-direct {v0, v1}, Lorg/spongycastle/crypto/DataLengthException;-><init>(Ljava/lang/String;)V
throw v0
:cond_1d
move v0, v1
.line 299
:goto_1e
iget v2, p0, Lorg/spongycastle/crypto/engines/ThreefishEngine;->blocksizeBytes:I
if-ge v0, v2, :cond_31
.line 301
iget-object v2, p0, Lorg/spongycastle/crypto/engines/ThreefishEngine;->currentBlock:[J
shr-int/lit8 v3, v0, 0x3
add-int v4, p2, v0
invoke-static {p1, v4}, Lorg/spongycastle/crypto/engines/ThreefishEngine;->bytesToWord([BI)J
move-result-wide v4
aput-wide v4, v2, v3
.line 299
add-int/lit8 v0, v0, 0x8
goto :goto_1e
.line 303
:cond_31
iget-object v0, p0, Lorg/spongycastle/crypto/engines/ThreefishEngine;->currentBlock:[J
iget-object v2, p0, Lorg/spongycastle/crypto/engines/ThreefishEngine;->currentBlock:[J
invoke-virtual {p0, v0, v2}, Lorg/spongycastle/crypto/engines/ThreefishEngine;->processBlock([J[J)I
.line 304
:goto_38
iget v0, p0, Lorg/spongycastle/crypto/engines/ThreefishEngine;->blocksizeBytes:I
if-ge v1, v0, :cond_4a
.line 306
iget-object v0, p0, Lorg/spongycastle/crypto/engines/ThreefishEngine;->currentBlock:[J
shr-int/lit8 v2, v1, 0x3
aget-wide v2, v0, v2
add-int v0, p4, v1
invoke-static {v2, v3, p3, v0}, Lorg/spongycastle/crypto/engines/ThreefishEngine;->wordToBytes(J[BI)V
.line 304
add-int/lit8 v1, v1, 0x8
goto :goto_38
.line 309
:cond_4a
iget v0, p0, Lorg/spongycastle/crypto/engines/ThreefishEngine;->blocksizeBytes:I
return v0
.end method
.method public processBlock([J[J)I
.registers 7
.prologue
.line 324
iget-object v0, p0, Lorg/spongycastle/crypto/engines/ThreefishEngine;->kw:[J
iget v1, p0, Lorg/spongycastle/crypto/engines/ThreefishEngine;->blocksizeWords:I
aget-wide v0, v0, v1
const-wide/16 v2, 0x0
cmp-long v0, v0, v2
if-nez v0, :cond_14
.line 326
new-instance v0, Ljava/lang/IllegalStateException;
const-string v1, "Threefish engine not initialised"
invoke-direct {v0, v1}, Ljava/lang/IllegalStateException;-><init>(Ljava/lang/String;)V
throw v0
.line 329
:cond_14
array-length v0, p1
iget v1, p0, Lorg/spongycastle/crypto/engines/ThreefishEngine;->blocksizeWords:I
if-eq v0, v1, :cond_21
.line 331
new-instance v0, Lorg/spongycastle/crypto/DataLengthException;
const-string v1, "Input buffer too short"
invoke-direct {v0, v1}, Lorg/spongycastle/crypto/DataLengthException;-><init>(Ljava/lang/String;)V
throw v0
.line 333
:cond_21
array-length v0, p2
iget v1, p0, Lorg/spongycastle/crypto/engines/ThreefishEngine;->blocksizeWords:I
if-eq v0, v1, :cond_2e
.line 335
new-instance v0, Lorg/spongycastle/crypto/DataLengthException;
const-string v1, "Output buffer too short"
invoke-direct {v0, v1}, Lorg/spongycastle/crypto/DataLengthException;-><init>(Ljava/lang/String;)V
throw v0
.line 338
:cond_2e
iget-boolean v0, p0, Lorg/spongycastle/crypto/engines/ThreefishEngine;->forEncryption:Z
if-eqz v0, :cond_3a
.line 340
iget-object v0, p0, Lorg/spongycastle/crypto/engines/ThreefishEngine;->cipher:Lorg/spongycastle/crypto/engines/ThreefishEngine$ThreefishCipher;
invoke-virtual {v0, p1, p2}, Lorg/spongycastle/crypto/engines/ThreefishEngine$ThreefishCipher;->encryptBlock([J[J)V
.line 347
:goto_37
iget v0, p0, Lorg/spongycastle/crypto/engines/ThreefishEngine;->blocksizeWords:I
return v0
.line 344
:cond_3a
iget-object v0, p0, Lorg/spongycastle/crypto/engines/ThreefishEngine;->cipher:Lorg/spongycastle/crypto/engines/ThreefishEngine$ThreefishCipher;
invoke-virtual {v0, p1, p2}, Lorg/spongycastle/crypto/engines/ThreefishEngine$ThreefishCipher;->decryptBlock([J[J)V
goto :goto_37
.end method
.method public reset()V
.registers 1
.prologue
.line 283
return-void
.end method