GF2nONBField.smali

.class public Lorg/spongycastle/pqc/math/linearalgebra/GF2nONBField;
.super Lorg/spongycastle/pqc/math/linearalgebra/GF2nField;
.source "GF2nONBField.java"


# static fields
.field private static final MAXLONG:I = 0x40


# instance fields
.field private mBit:I

.field private mLength:I

.field mMult:[[I

.field private mType:I


# direct methods
.method public constructor <init>(ILjava/security/SecureRandom;)V
    .registers 8

    .prologue
    const/4 v2, 0x3

    const/4 v1, 0x0

    const/4 v4, -0x1

    .line 110
    invoke-direct {p0, p2}, Lorg/spongycastle/pqc/math/linearalgebra/GF2nField;-><init>(Ljava/security/SecureRandom;)V

    .line 112
    if-ge p1, v2, :cond_10

    .line 114
    new-instance v0, Ljava/lang/IllegalArgumentException;

    const-string v1, "k must be at least 3"

    invoke-direct {v0, v1}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V

    throw v0

    .line 117
    :cond_10
    iput p1, p0, Lorg/spongycastle/pqc/math/linearalgebra/GF2nONBField;->mDegree:I

    .line 118
    iget v0, p0, Lorg/spongycastle/pqc/math/linearalgebra/GF2nONBField;->mDegree:I

    div-int/lit8 v0, v0, 0x40

    iput v0, p0, Lorg/spongycastle/pqc/math/linearalgebra/GF2nONBField;->mLength:I

    .line 119
    iget v0, p0, Lorg/spongycastle/pqc/math/linearalgebra/GF2nONBField;->mDegree:I

    and-int/lit8 v0, v0, 0x3f

    iput v0, p0, Lorg/spongycastle/pqc/math/linearalgebra/GF2nONBField;->mBit:I

    .line 120
    iget v0, p0, Lorg/spongycastle/pqc/math/linearalgebra/GF2nONBField;->mBit:I

    if-nez v0, :cond_53

    .line 122
    const/16 v0, 0x40

    iput v0, p0, Lorg/spongycastle/pqc/math/linearalgebra/GF2nONBField;->mBit:I

    .line 129
    :goto_26
    invoke-direct {p0}, Lorg/spongycastle/pqc/math/linearalgebra/GF2nONBField;->computeType()V

    .line 133
    iget v0, p0, Lorg/spongycastle/pqc/math/linearalgebra/GF2nONBField;->mType:I

    if-ge v0, v2, :cond_6f

    .line 135
    iget v0, p0, Lorg/spongycastle/pqc/math/linearalgebra/GF2nONBField;->mDegree:I

    const/4 v2, 0x2

    filled-new-array {v0, v2}, [I

    move-result-object v0

    sget-object v2, Ljava/lang/Integer;->TYPE:Ljava/lang/Class;

    invoke-static {v2, v0}, Ljava/lang/reflect/Array;->newInstance(Ljava/lang/Class;[I)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, [[I

    iput-object v0, p0, Lorg/spongycastle/pqc/math/linearalgebra/GF2nONBField;->mMult:[[I

    move v0, v1

    .line 136
    :goto_3f
    iget v2, p0, Lorg/spongycastle/pqc/math/linearalgebra/GF2nONBField;->mDegree:I

    if-ge v0, v2, :cond_5a

    .line 138
    iget-object v2, p0, Lorg/spongycastle/pqc/math/linearalgebra/GF2nONBField;->mMult:[[I

    aget-object v2, v2, v0

    aput v4, v2, v1

    .line 139
    iget-object v2, p0, Lorg/spongycastle/pqc/math/linearalgebra/GF2nONBField;->mMult:[[I

    aget-object v2, v2, v0

    const/4 v3, 0x1

    aput v4, v2, v3

    .line 136
    add-int/lit8 v0, v0, 0x1

    goto :goto_3f

    .line 126
    :cond_53
    iget v0, p0, Lorg/spongycastle/pqc/math/linearalgebra/GF2nONBField;->mLength:I

    add-int/lit8 v0, v0, 0x1

    iput v0, p0, Lorg/spongycastle/pqc/math/linearalgebra/GF2nONBField;->mLength:I

    goto :goto_26

    .line 141
    :cond_5a
    invoke-direct {p0}, Lorg/spongycastle/pqc/math/linearalgebra/GF2nONBField;->computeMultMatrix()V

    .line 148
    invoke-virtual {p0}, Lorg/spongycastle/pqc/math/linearalgebra/GF2nONBField;->computeFieldPolynomial()V

    .line 149
    new-instance v0, Ljava/util/Vector;

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

    iput-object v0, p0, Lorg/spongycastle/pqc/math/linearalgebra/GF2nONBField;->fields:Ljava/util/Vector;

    .line 150
    new-instance v0, Ljava/util/Vector;

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

    iput-object v0, p0, Lorg/spongycastle/pqc/math/linearalgebra/GF2nONBField;->matrices:Ljava/util/Vector;

    .line 151
    return-void

    .line 145
    :cond_6f
    new-instance v0, Ljava/lang/RuntimeException;

    new-instance v1, Ljava/lang/StringBuilder;

    const-string v2, "\nThe type of this field is "

    invoke-direct {v1, v2}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    iget v2, p0, Lorg/spongycastle/pqc/math/linearalgebra/GF2nONBField;->mType:I

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(I)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/RuntimeException;-><init>(Ljava/lang/String;)V

    throw v0
.end method

.method private computeMultMatrix()V
    .registers 13

    .prologue
    const/4 v11, 0x2

    const/4 v10, -0x1

    const/4 v3, 0x0

    const/4 v1, 0x1

    .line 396
    iget v0, p0, Lorg/spongycastle/pqc/math/linearalgebra/GF2nONBField;->mType:I

    and-int/lit8 v0, v0, 0x7

    if-eqz v0, :cond_109

    .line 398
    iget v0, p0, Lorg/spongycastle/pqc/math/linearalgebra/GF2nONBField;->mType:I

    iget v2, p0, Lorg/spongycastle/pqc/math/linearalgebra/GF2nONBField;->mDegree:I

    mul-int/2addr v0, v2

    add-int/lit8 v7, v0, 0x1

    .line 403
    new-array v8, v7, [I

    .line 406
    iget v0, p0, Lorg/spongycastle/pqc/math/linearalgebra/GF2nONBField;->mType:I

    if-ne v0, v1, :cond_2f

    move v0, v1

    :goto_18
    move v2, v3

    move v4, v1

    .line 421
    :goto_1a
    iget v5, p0, Lorg/spongycastle/pqc/math/linearalgebra/GF2nONBField;->mType:I

    if-ge v2, v5, :cond_45

    move v5, v3

    move v6, v4

    .line 425
    :goto_20
    iget v9, p0, Lorg/spongycastle/pqc/math/linearalgebra/GF2nONBField;->mDegree:I

    if-ge v5, v9, :cond_3d

    .line 427
    aput v5, v8, v6

    .line 428
    shl-int/lit8 v6, v6, 0x1

    rem-int/2addr v6, v7

    .line 429
    if-gez v6, :cond_2c

    .line 431
    add-int/2addr v6, v7

    .line 425
    :cond_2c
    add-int/lit8 v5, v5, 0x1

    goto :goto_20

    .line 410
    :cond_2f
    iget v0, p0, Lorg/spongycastle/pqc/math/linearalgebra/GF2nONBField;->mType:I

    if-ne v0, v11, :cond_36

    .line 412
    add-int/lit8 v0, v7, -0x1

    goto :goto_18

    .line 416
    :cond_36
    iget v0, p0, Lorg/spongycastle/pqc/math/linearalgebra/GF2nONBField;->mType:I

    invoke-direct {p0, v0, v7}, Lorg/spongycastle/pqc/math/linearalgebra/GF2nONBField;->elementOfOrder(II)I

    move-result v0

    goto :goto_18

    .line 434
    :cond_3d
    mul-int/2addr v4, v0

    rem-int/2addr v4, v7

    .line 435
    if-gez v4, :cond_42

    .line 437
    add-int/2addr v4, v7

    .line 421
    :cond_42
    add-int/lit8 v2, v2, 0x1

    goto :goto_1a

    .line 443
    :cond_45
    iget v0, p0, Lorg/spongycastle/pqc/math/linearalgebra/GF2nONBField;->mType:I

    if-ne v0, v1, :cond_cc

    move v0, v1

    .line 445
    :goto_4a
    add-int/lit8 v2, v7, -0x1

    if-ge v0, v2, :cond_7a

    .line 447
    iget-object v2, p0, Lorg/spongycastle/pqc/math/linearalgebra/GF2nONBField;->mMult:[[I

    add-int/lit8 v4, v0, 0x1

    aget v4, v8, v4

    aget-object v2, v2, v4

    aget v2, v2, v3

    if-ne v2, v10, :cond_6b

    .line 449
    iget-object v2, p0, Lorg/spongycastle/pqc/math/linearalgebra/GF2nONBField;->mMult:[[I

    add-int/lit8 v4, v0, 0x1

    aget v4, v8, v4

    aget-object v2, v2, v4

    sub-int v4, v7, v0

    aget v4, v8, v4

    aput v4, v2, v3

    .line 445
    :goto_68
    add-int/lit8 v0, v0, 0x1

    goto :goto_4a

    .line 453
    :cond_6b
    iget-object v2, p0, Lorg/spongycastle/pqc/math/linearalgebra/GF2nONBField;->mMult:[[I

    add-int/lit8 v4, v0, 0x1

    aget v4, v8, v4

    aget-object v2, v2, v4

    sub-int v4, v7, v0

    aget v4, v8, v4

    aput v4, v2, v1

    goto :goto_68

    .line 457
    :cond_7a
    iget v0, p0, Lorg/spongycastle/pqc/math/linearalgebra/GF2nONBField;->mDegree:I

    shr-int/lit8 v2, v0, 0x1

    move v0, v1

    .line 458
    :goto_7f
    if-gt v0, v2, :cond_111

    .line 461
    iget-object v4, p0, Lorg/spongycastle/pqc/math/linearalgebra/GF2nONBField;->mMult:[[I

    add-int/lit8 v5, v0, -0x1

    aget-object v4, v4, v5

    aget v4, v4, v3

    if-ne v4, v10, :cond_b2

    .line 463
    iget-object v4, p0, Lorg/spongycastle/pqc/math/linearalgebra/GF2nONBField;->mMult:[[I

    add-int/lit8 v5, v0, -0x1

    aget-object v4, v4, v5

    add-int v5, v2, v0

    add-int/lit8 v5, v5, -0x1

    aput v5, v4, v3

    .line 470
    :goto_97
    iget-object v4, p0, Lorg/spongycastle/pqc/math/linearalgebra/GF2nONBField;->mMult:[[I

    add-int v5, v2, v0

    add-int/lit8 v5, v5, -0x1

    aget-object v4, v4, v5

    aget v4, v4, v3

    if-ne v4, v10, :cond_bf

    .line 472
    iget-object v4, p0, Lorg/spongycastle/pqc/math/linearalgebra/GF2nONBField;->mMult:[[I

    add-int v5, v2, v0

    add-int/lit8 v5, v5, -0x1

    aget-object v4, v4, v5

    add-int/lit8 v5, v0, -0x1

    aput v5, v4, v3

    .line 458
    :goto_af
    add-int/lit8 v0, v0, 0x1

    goto :goto_7f

    .line 467
    :cond_b2
    iget-object v4, p0, Lorg/spongycastle/pqc/math/linearalgebra/GF2nONBField;->mMult:[[I

    add-int/lit8 v5, v0, -0x1

    aget-object v4, v4, v5

    add-int v5, v2, v0

    add-int/lit8 v5, v5, -0x1

    aput v5, v4, v1

    goto :goto_97

    .line 476
    :cond_bf
    iget-object v4, p0, Lorg/spongycastle/pqc/math/linearalgebra/GF2nONBField;->mMult:[[I

    add-int v5, v2, v0

    add-int/lit8 v5, v5, -0x1

    aget-object v4, v4, v5

    add-int/lit8 v5, v0, -0x1

    aput v5, v4, v1

    goto :goto_af

    .line 480
    :cond_cc
    iget v0, p0, Lorg/spongycastle/pqc/math/linearalgebra/GF2nONBField;->mType:I

    if-ne v0, v11, :cond_101

    move v0, v1

    .line 482
    :goto_d1
    add-int/lit8 v2, v7, -0x1

    if-ge v0, v2, :cond_111

    .line 484
    iget-object v2, p0, Lorg/spongycastle/pqc/math/linearalgebra/GF2nONBField;->mMult:[[I

    add-int/lit8 v4, v0, 0x1

    aget v4, v8, v4

    aget-object v2, v2, v4

    aget v2, v2, v3

    if-ne v2, v10, :cond_f2

    .line 486
    iget-object v2, p0, Lorg/spongycastle/pqc/math/linearalgebra/GF2nONBField;->mMult:[[I

    add-int/lit8 v4, v0, 0x1

    aget v4, v8, v4

    aget-object v2, v2, v4

    sub-int v4, v7, v0

    aget v4, v8, v4

    aput v4, v2, v3

    .line 482
    :goto_ef
    add-int/lit8 v0, v0, 0x1

    goto :goto_d1

    .line 490
    :cond_f2
    iget-object v2, p0, Lorg/spongycastle/pqc/math/linearalgebra/GF2nONBField;->mMult:[[I

    add-int/lit8 v4, v0, 0x1

    aget v4, v8, v4

    aget-object v2, v2, v4

    sub-int v4, v7, v0

    aget v4, v8, v4

    aput v4, v2, v1

    goto :goto_ef

    .line 496
    :cond_101
    new-instance v0, Ljava/lang/RuntimeException;

    const-string v1, "only type 1 or type 2 implemented"

    invoke-direct {v0, v1}, Ljava/lang/RuntimeException;-><init>(Ljava/lang/String;)V

    throw v0

    .line 501
    :cond_109
    new-instance v0, Ljava/lang/RuntimeException;

    const-string v1, "bisher nur fuer Gausssche Normalbasen implementiert"

    invoke-direct {v0, v1}, Ljava/lang/RuntimeException;-><init>(Ljava/lang/String;)V

    throw v0

    .line 482
    :cond_111
    return-void
.end method

.method private computeType()V
    .registers 6

    .prologue
    const/4 v4, 0x2

    const/4 v3, 0x1

    .line 359
    iget v0, p0, Lorg/spongycastle/pqc/math/linearalgebra/GF2nONBField;->mDegree:I

    and-int/lit8 v0, v0, 0x7

    if-nez v0, :cond_10

    .line 361
    new-instance v0, Ljava/lang/RuntimeException;

    const-string v1, "The extension degree is divisible by 8!"

    invoke-direct {v0, v1}, Ljava/lang/RuntimeException;-><init>(Ljava/lang/String;)V

    throw v0

    .line 367
    :cond_10
    iput v3, p0, Lorg/spongycastle/pqc/math/linearalgebra/GF2nONBField;->mType:I

    .line 368
    const/4 v0, 0x0

    :goto_13
    if-eq v0, v3, :cond_3a

    .line 370
    iget v1, p0, Lorg/spongycastle/pqc/math/linearalgebra/GF2nONBField;->mType:I

    iget v2, p0, Lorg/spongycastle/pqc/math/linearalgebra/GF2nONBField;->mDegree:I

    mul-int/2addr v1, v2

    add-int/lit8 v1, v1, 0x1

    .line 371
    invoke-static {v1}, Lorg/spongycastle/pqc/math/linearalgebra/IntegerFunctions;->isPrime(I)Z

    move-result v2

    if-eqz v2, :cond_33

    .line 373
    invoke-static {v4, v1}, Lorg/spongycastle/pqc/math/linearalgebra/IntegerFunctions;->order(II)I

    move-result v0

    .line 374
    iget v1, p0, Lorg/spongycastle/pqc/math/linearalgebra/GF2nONBField;->mType:I

    iget v2, p0, Lorg/spongycastle/pqc/math/linearalgebra/GF2nONBField;->mDegree:I

    mul-int/2addr v1, v2

    div-int v0, v1, v0

    iget v1, p0, Lorg/spongycastle/pqc/math/linearalgebra/GF2nONBField;->mDegree:I

    invoke-static {v0, v1}, Lorg/spongycastle/pqc/math/linearalgebra/IntegerFunctions;->gcd(II)I

    move-result v0

    .line 368
    :cond_33
    iget v1, p0, Lorg/spongycastle/pqc/math/linearalgebra/GF2nONBField;->mType:I

    add-int/lit8 v1, v1, 0x1

    iput v1, p0, Lorg/spongycastle/pqc/math/linearalgebra/GF2nONBField;->mType:I

    goto :goto_13

    .line 377
    :cond_3a
    iget v0, p0, Lorg/spongycastle/pqc/math/linearalgebra/GF2nONBField;->mType:I

    add-int/lit8 v0, v0, -0x1

    iput v0, p0, Lorg/spongycastle/pqc/math/linearalgebra/GF2nONBField;->mType:I

    .line 378
    iget v0, p0, Lorg/spongycastle/pqc/math/linearalgebra/GF2nONBField;->mType:I

    if-ne v0, v3, :cond_68

    .line 380
    iget v0, p0, Lorg/spongycastle/pqc/math/linearalgebra/GF2nONBField;->mDegree:I

    shl-int/lit8 v0, v0, 0x1

    add-int/lit8 v0, v0, 0x1

    .line 381
    invoke-static {v0}, Lorg/spongycastle/pqc/math/linearalgebra/IntegerFunctions;->isPrime(I)Z

    move-result v1

    if-eqz v1, :cond_68

    .line 383
    invoke-static {v4, v0}, Lorg/spongycastle/pqc/math/linearalgebra/IntegerFunctions;->order(II)I

    move-result v0

    .line 384
    iget v1, p0, Lorg/spongycastle/pqc/math/linearalgebra/GF2nONBField;->mDegree:I

    shl-int/lit8 v1, v1, 0x1

    div-int v0, v1, v0

    iget v1, p0, Lorg/spongycastle/pqc/math/linearalgebra/GF2nONBField;->mDegree:I

    invoke-static {v0, v1}, Lorg/spongycastle/pqc/math/linearalgebra/IntegerFunctions;->gcd(II)I

    move-result v0

    .line 385
    if-ne v0, v3, :cond_68

    .line 387
    iget v0, p0, Lorg/spongycastle/pqc/math/linearalgebra/GF2nONBField;->mType:I

    add-int/lit8 v0, v0, 0x1

    iput v0, p0, Lorg/spongycastle/pqc/math/linearalgebra/GF2nONBField;->mType:I

    .line 391
    :cond_68
    return-void
.end method

.method private elementOfOrder(II)I
    .registers 7

    .prologue
    .line 508
    new-instance v2, Ljava/util/Random;

    invoke-direct {v2}, Ljava/util/Random;-><init>()V

    .line 509
    const/4 v1, 0x0

    .line 510
    :cond_6
    :goto_6
    if-nez v1, :cond_16

    .line 512
    invoke-virtual {v2}, Ljava/util/Random;->nextInt()I

    move-result v0

    .line 513
    add-int/lit8 v1, p2, -0x1

    rem-int v1, v0, v1

    .line 514
    if-gez v1, :cond_6

    .line 516
    add-int/lit8 v0, p2, -0x1

    add-int/2addr v1, v0

    goto :goto_6

    .line 520
    :cond_16
    invoke-static {v1, p2}, Lorg/spongycastle/pqc/math/linearalgebra/IntegerFunctions;->order(II)I

    move-result v0

    .line 522
    :goto_1a
    rem-int v3, v0, p1

    if-nez v3, :cond_20

    if-nez v0, :cond_35

    .line 524
    :cond_20
    :goto_20
    if-nez v1, :cond_30

    .line 526
    invoke-virtual {v2}, Ljava/util/Random;->nextInt()I

    move-result v0

    .line 527
    add-int/lit8 v1, p2, -0x1

    rem-int v1, v0, v1

    .line 528
    if-gez v1, :cond_20

    .line 530
    add-int/lit8 v0, p2, -0x1

    add-int/2addr v1, v0

    goto :goto_20

    .line 533
    :cond_30
    invoke-static {v1, p2}, Lorg/spongycastle/pqc/math/linearalgebra/IntegerFunctions;->order(II)I

    move-result v0

    goto :goto_1a

    .line 537
    :cond_35
    div-int v3, p1, v0

    .line 539
    const/4 v0, 0x2

    move v2, v0

    move v0, v1

    :goto_3a
    if-gt v2, v3, :cond_40

    .line 541
    mul-int/2addr v0, v1

    .line 539
    add-int/lit8 v2, v2, 0x1

    goto :goto_3a

    .line 544
    :cond_40
    return v0
.end method


# virtual methods
.method protected computeCOBMatrix(Lorg/spongycastle/pqc/math/linearalgebra/GF2nField;)V
    .registers 9

    .prologue
    const/4 v1, 0x0

    .line 244
    iget v0, p0, Lorg/spongycastle/pqc/math/linearalgebra/GF2nONBField;->mDegree:I

    iget v2, p1, Lorg/spongycastle/pqc/math/linearalgebra/GF2nField;->mDegree:I

    if-eq v0, v2, :cond_f

    .line 246
    new-instance v0, Ljava/lang/IllegalArgumentException;

    const-string v1, "GF2nField.computeCOBMatrix: B1 has a different degree and thus cannot be coverted to!"

    invoke-direct {v0, v1}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V

    throw v0

    .line 253
    :cond_f
    iget v0, p0, Lorg/spongycastle/pqc/math/linearalgebra/GF2nONBField;->mDegree:I

    new-array v3, v0, [Lorg/spongycastle/pqc/math/linearalgebra/GF2Polynomial;

    move v0, v1

    .line 254
    :goto_14
    iget v2, p0, Lorg/spongycastle/pqc/math/linearalgebra/GF2nONBField;->mDegree:I

    if-ge v0, v2, :cond_24

    .line 256
    new-instance v2, Lorg/spongycastle/pqc/math/linearalgebra/GF2Polynomial;

    iget v4, p0, Lorg/spongycastle/pqc/math/linearalgebra/GF2nONBField;->mDegree:I

    invoke-direct {v2, v4}, Lorg/spongycastle/pqc/math/linearalgebra/GF2Polynomial;-><init>(I)V

    aput-object v2, v3, v0

    .line 254
    add-int/lit8 v0, v0, 0x1

    goto :goto_14

    .line 263
    :cond_24
    iget-object v0, p0, Lorg/spongycastle/pqc/math/linearalgebra/GF2nONBField;->fieldPolynomial:Lorg/spongycastle/pqc/math/linearalgebra/GF2Polynomial;

    invoke-virtual {p1, v0}, Lorg/spongycastle/pqc/math/linearalgebra/GF2nField;->getRandomRoot(Lorg/spongycastle/pqc/math/linearalgebra/GF2Polynomial;)Lorg/spongycastle/pqc/math/linearalgebra/GF2nElement;

    move-result-object v0

    .line 265
    invoke-virtual {v0}, Lorg/spongycastle/pqc/math/linearalgebra/GF2nElement;->isZero()Z

    move-result v2

    if-nez v2, :cond_24

    .line 267
    iget v2, p0, Lorg/spongycastle/pqc/math/linearalgebra/GF2nONBField;->mDegree:I

    new-array v4, v2, [Lorg/spongycastle/pqc/math/linearalgebra/GF2nPolynomialElement;

    .line 269
    invoke-virtual {v0}, Lorg/spongycastle/pqc/math/linearalgebra/GF2nElement;->clone()Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lorg/spongycastle/pqc/math/linearalgebra/GF2nElement;

    aput-object v0, v4, v1

    .line 270
    const/4 v0, 0x1

    :goto_3d
    iget v2, p0, Lorg/spongycastle/pqc/math/linearalgebra/GF2nONBField;->mDegree:I

    if-ge v0, v2, :cond_4e

    .line 272
    add-int/lit8 v2, v0, -0x1

    aget-object v2, v4, v2

    invoke-virtual {v2}, Lorg/spongycastle/pqc/math/linearalgebra/GF2nElement;->square()Lorg/spongycastle/pqc/math/linearalgebra/GF2nElement;

    move-result-object v2

    aput-object v2, v4, v0

    .line 270
    add-int/lit8 v0, v0, 0x1

    goto :goto_3d

    :cond_4e
    move v0, v1

    .line 275
    :goto_4f
    iget v2, p0, Lorg/spongycastle/pqc/math/linearalgebra/GF2nONBField;->mDegree:I

    if-ge v0, v2, :cond_75

    move v2, v1

    .line 277
    :goto_54
    iget v5, p0, Lorg/spongycastle/pqc/math/linearalgebra/GF2nONBField;->mDegree:I

    if-ge v2, v5, :cond_72

    .line 279
    aget-object v5, v4, v0

    invoke-virtual {v5, v2}, Lorg/spongycastle/pqc/math/linearalgebra/GF2nElement;->testBit(I)Z

    move-result v5

    if-eqz v5, :cond_6f

    .line 281
    iget v5, p0, Lorg/spongycastle/pqc/math/linearalgebra/GF2nONBField;->mDegree:I

    sub-int/2addr v5, v2

    add-int/lit8 v5, v5, -0x1

    aget-object v5, v3, v5

    iget v6, p0, Lorg/spongycastle/pqc/math/linearalgebra/GF2nONBField;->mDegree:I

    sub-int/2addr v6, v0

    add-int/lit8 v6, v6, -0x1

    invoke-virtual {v5, v6}, Lorg/spongycastle/pqc/math/linearalgebra/GF2Polynomial;->setBit(I)V

    .line 277
    :cond_6f
    add-int/lit8 v2, v2, 0x1

    goto :goto_54

    .line 275
    :cond_72
    add-int/lit8 v0, v0, 0x1

    goto :goto_4f

    .line 286
    :cond_75
    iget-object v0, p0, Lorg/spongycastle/pqc/math/linearalgebra/GF2nONBField;->fields:Ljava/util/Vector;

    invoke-virtual {v0, p1}, Ljava/util/Vector;->addElement(Ljava/lang/Object;)V

    .line 287
    iget-object v0, p0, Lorg/spongycastle/pqc/math/linearalgebra/GF2nONBField;->matrices:Ljava/util/Vector;

    invoke-virtual {v0, v3}, Ljava/util/Vector;->addElement(Ljava/lang/Object;)V

    .line 288
    iget-object v0, p1, Lorg/spongycastle/pqc/math/linearalgebra/GF2nField;->fields:Ljava/util/Vector;

    invoke-virtual {v0, p0}, Ljava/util/Vector;->addElement(Ljava/lang/Object;)V

    .line 289
    iget-object v0, p1, Lorg/spongycastle/pqc/math/linearalgebra/GF2nField;->matrices:Ljava/util/Vector;

    invoke-virtual {p0, v3}, Lorg/spongycastle/pqc/math/linearalgebra/GF2nONBField;->invertMatrix([Lorg/spongycastle/pqc/math/linearalgebra/GF2Polynomial;)[Lorg/spongycastle/pqc/math/linearalgebra/GF2Polynomial;

    move-result-object v1

    invoke-virtual {v0, v1}, Ljava/util/Vector;->addElement(Ljava/lang/Object;)V

    .line 290
    return-void
.end method

.method protected computeFieldPolynomial()V
    .registers 6

    .prologue
    const/4 v0, 0x1

    .line 300
    iget v1, p0, Lorg/spongycastle/pqc/math/linearalgebra/GF2nONBField;->mType:I

    if-ne v1, v0, :cond_13

    .line 302
    new-instance v0, Lorg/spongycastle/pqc/math/linearalgebra/GF2Polynomial;

    iget v1, p0, Lorg/spongycastle/pqc/math/linearalgebra/GF2nONBField;->mDegree:I

    add-int/lit8 v1, v1, 0x1

    const-string v2, "ALL"

    invoke-direct {v0, v1, v2}, Lorg/spongycastle/pqc/math/linearalgebra/GF2Polynomial;-><init>(ILjava/lang/String;)V

    iput-object v0, p0, Lorg/spongycastle/pqc/math/linearalgebra/GF2nONBField;->fieldPolynomial:Lorg/spongycastle/pqc/math/linearalgebra/GF2Polynomial;

    .line 326
    :cond_12
    :goto_12
    return-void

    .line 304
    :cond_13
    iget v1, p0, Lorg/spongycastle/pqc/math/linearalgebra/GF2nONBField;->mType:I

    const/4 v2, 0x2

    if-ne v1, v2, :cond_12

    .line 307
    new-instance v2, Lorg/spongycastle/pqc/math/linearalgebra/GF2Polynomial;

    iget v1, p0, Lorg/spongycastle/pqc/math/linearalgebra/GF2nONBField;->mDegree:I

    add-int/lit8 v1, v1, 0x1

    const-string v3, "ONE"

    invoke-direct {v2, v1, v3}, Lorg/spongycastle/pqc/math/linearalgebra/GF2Polynomial;-><init>(ILjava/lang/String;)V

    .line 309
    new-instance v1, Lorg/spongycastle/pqc/math/linearalgebra/GF2Polynomial;

    iget v3, p0, Lorg/spongycastle/pqc/math/linearalgebra/GF2nONBField;->mDegree:I

    add-int/lit8 v3, v3, 0x1

    const-string v4, "X"

    invoke-direct {v1, v3, v4}, Lorg/spongycastle/pqc/math/linearalgebra/GF2Polynomial;-><init>(ILjava/lang/String;)V

    .line 310
    invoke-virtual {v1, v2}, Lorg/spongycastle/pqc/math/linearalgebra/GF2Polynomial;->addToThis(Lorg/spongycastle/pqc/math/linearalgebra/GF2Polynomial;)V

    move-object v3, v2

    .line 314
    :goto_32
    iget v2, p0, Lorg/spongycastle/pqc/math/linearalgebra/GF2nONBField;->mDegree:I

    if-ge v0, v2, :cond_42

    .line 321
    invoke-virtual {v1}, Lorg/spongycastle/pqc/math/linearalgebra/GF2Polynomial;->shiftLeft()Lorg/spongycastle/pqc/math/linearalgebra/GF2Polynomial;

    move-result-object v2

    .line 322
    invoke-virtual {v2, v3}, Lorg/spongycastle/pqc/math/linearalgebra/GF2Polynomial;->addToThis(Lorg/spongycastle/pqc/math/linearalgebra/GF2Polynomial;)V

    .line 314
    add-int/lit8 v0, v0, 0x1

    move-object v3, v1

    move-object v1, v2

    goto :goto_32

    .line 324
    :cond_42
    iput-object v1, p0, Lorg/spongycastle/pqc/math/linearalgebra/GF2nONBField;->fieldPolynomial:Lorg/spongycastle/pqc/math/linearalgebra/GF2Polynomial;

    goto :goto_12
.end method

.method getONBBit()I
    .registers 2

    .prologue
    .line 164
    iget v0, p0, Lorg/spongycastle/pqc/math/linearalgebra/GF2nONBField;->mBit:I

    return v0
.end method

.method getONBLength()I
    .registers 2

    .prologue
    .line 159
    iget v0, p0, Lorg/spongycastle/pqc/math/linearalgebra/GF2nONBField;->mLength:I

    return v0
.end method

.method protected getRandomRoot(Lorg/spongycastle/pqc/math/linearalgebra/GF2Polynomial;)Lorg/spongycastle/pqc/math/linearalgebra/GF2nElement;
    .registers 8

    .prologue
    const/4 v1, 0x1

    .line 187
    new-instance v2, Lorg/spongycastle/pqc/math/linearalgebra/GF2nPolynomial;

    invoke-direct {v2, p1, p0}, Lorg/spongycastle/pqc/math/linearalgebra/GF2nPolynomial;-><init>(Lorg/spongycastle/pqc/math/linearalgebra/GF2Polynomial;Lorg/spongycastle/pqc/math/linearalgebra/GF2nField;)V

    .line 188
    invoke-virtual {v2}, Lorg/spongycastle/pqc/math/linearalgebra/GF2nPolynomial;->getDegree()I

    move-result v0

    move-object v3, v2

    .line 192
    :goto_b
    if-le v0, v1, :cond_5e

    .line 197
    :cond_d
    new-instance v0, Lorg/spongycastle/pqc/math/linearalgebra/GF2nONBElement;

    iget-object v2, p0, Lorg/spongycastle/pqc/math/linearalgebra/GF2nONBField;->random:Ljava/security/SecureRandom;

    invoke-direct {v0, p0, v2}, Lorg/spongycastle/pqc/math/linearalgebra/GF2nONBElement;-><init>(Lorg/spongycastle/pqc/math/linearalgebra/GF2nONBField;Ljava/security/SecureRandom;)V

    .line 198
    new-instance v4, Lorg/spongycastle/pqc/math/linearalgebra/GF2nPolynomial;

    const/4 v2, 0x2

    invoke-static {p0}, Lorg/spongycastle/pqc/math/linearalgebra/GF2nONBElement;->ZERO(Lorg/spongycastle/pqc/math/linearalgebra/GF2nONBField;)Lorg/spongycastle/pqc/math/linearalgebra/GF2nONBElement;

    move-result-object v5

    invoke-direct {v4, v2, v5}, Lorg/spongycastle/pqc/math/linearalgebra/GF2nPolynomial;-><init>(ILorg/spongycastle/pqc/math/linearalgebra/GF2nElement;)V

    .line 200
    invoke-virtual {v4, v1, v0}, Lorg/spongycastle/pqc/math/linearalgebra/GF2nPolynomial;->set(ILorg/spongycastle/pqc/math/linearalgebra/GF2nElement;)V

    .line 201
    new-instance v0, Lorg/spongycastle/pqc/math/linearalgebra/GF2nPolynomial;

    invoke-direct {v0, v4}, Lorg/spongycastle/pqc/math/linearalgebra/GF2nPolynomial;-><init>(Lorg/spongycastle/pqc/math/linearalgebra/GF2nPolynomial;)V

    move-object v2, v0

    move v0, v1

    .line 203
    :goto_28
    iget v5, p0, Lorg/spongycastle/pqc/math/linearalgebra/GF2nONBField;->mDegree:I

    add-int/lit8 v5, v5, -0x1

    if-gt v0, v5, :cond_39

    .line 206
    invoke-virtual {v2, v2, v3}, Lorg/spongycastle/pqc/math/linearalgebra/GF2nPolynomial;->multiplyAndReduce(Lorg/spongycastle/pqc/math/linearalgebra/GF2nPolynomial;Lorg/spongycastle/pqc/math/linearalgebra/GF2nPolynomial;)Lorg/spongycastle/pqc/math/linearalgebra/GF2nPolynomial;

    move-result-object v2

    .line 207
    invoke-virtual {v2, v4}, Lorg/spongycastle/pqc/math/linearalgebra/GF2nPolynomial;->add(Lorg/spongycastle/pqc/math/linearalgebra/GF2nPolynomial;)Lorg/spongycastle/pqc/math/linearalgebra/GF2nPolynomial;

    move-result-object v2

    .line 203
    add-int/lit8 v0, v0, 0x1

    goto :goto_28

    .line 210
    :cond_39
    invoke-virtual {v2, v3}, Lorg/spongycastle/pqc/math/linearalgebra/GF2nPolynomial;->gcd(Lorg/spongycastle/pqc/math/linearalgebra/GF2nPolynomial;)Lorg/spongycastle/pqc/math/linearalgebra/GF2nPolynomial;

    move-result-object v2

    .line 213
    invoke-virtual {v2}, Lorg/spongycastle/pqc/math/linearalgebra/GF2nPolynomial;->getDegree()I

    move-result v0

    .line 214
    invoke-virtual {v3}, Lorg/spongycastle/pqc/math/linearalgebra/GF2nPolynomial;->getDegree()I

    move-result v4

    .line 216
    if-eqz v0, :cond_d

    if-eq v0, v4, :cond_d

    .line 218
    shl-int/lit8 v0, v0, 0x1

    if-le v0, v4, :cond_58

    .line 220
    invoke-virtual {v3, v2}, Lorg/spongycastle/pqc/math/linearalgebra/GF2nPolynomial;->quotient(Lorg/spongycastle/pqc/math/linearalgebra/GF2nPolynomial;)Lorg/spongycastle/pqc/math/linearalgebra/GF2nPolynomial;

    move-result-object v0

    .line 227
    :goto_51
    invoke-virtual {v0}, Lorg/spongycastle/pqc/math/linearalgebra/GF2nPolynomial;->getDegree()I

    move-result v2

    move-object v3, v0

    move v0, v2

    goto :goto_b

    .line 225
    :cond_58
    new-instance v0, Lorg/spongycastle/pqc/math/linearalgebra/GF2nPolynomial;

    invoke-direct {v0, v2}, Lorg/spongycastle/pqc/math/linearalgebra/GF2nPolynomial;-><init>(Lorg/spongycastle/pqc/math/linearalgebra/GF2nPolynomial;)V

    goto :goto_51

    .line 230
    :cond_5e
    const/4 v0, 0x0

    invoke-virtual {v3, v0}, Lorg/spongycastle/pqc/math/linearalgebra/GF2nPolynomial;->at(I)Lorg/spongycastle/pqc/math/linearalgebra/GF2nElement;

    move-result-object v0

    return-object v0
.end method

.method invMatrix([[I)[[I
    .registers 7

    .prologue
    const/4 v2, 0x0

    .line 339
    iget v0, p0, Lorg/spongycastle/pqc/math/linearalgebra/GF2nONBField;->mDegree:I

    iget v1, p0, Lorg/spongycastle/pqc/math/linearalgebra/GF2nONBField;->mDegree:I

    filled-new-array {v0, v1}, [I

    move-result-object v0

    sget-object v1, Ljava/lang/Integer;->TYPE:Ljava/lang/Class;

    invoke-static {v1, v0}, Ljava/lang/reflect/Array;->newInstance(Ljava/lang/Class;[I)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, [[I

    move v1, v2

    .line 341
    :goto_12
    iget v3, p0, Lorg/spongycastle/pqc/math/linearalgebra/GF2nONBField;->mDegree:I

    if-ge v1, v3, :cond_1e

    .line 343
    aget-object v3, v0, v1

    const/4 v4, 0x1

    aput v4, v3, v1

    .line 341
    add-int/lit8 v1, v1, 0x1

    goto :goto_12

    :cond_1e
    move v1, v2

    .line 346
    :goto_1f
    iget v0, p0, Lorg/spongycastle/pqc/math/linearalgebra/GF2nONBField;->mDegree:I

    if-ge v1, v0, :cond_3b

    move v0, v1

    .line 348
    :goto_24
    iget v2, p0, Lorg/spongycastle/pqc/math/linearalgebra/GF2nONBField;->mDegree:I

    if-ge v0, v2, :cond_38

    .line 350
    iget v2, p0, Lorg/spongycastle/pqc/math/linearalgebra/GF2nONBField;->mDegree:I

    add-int/lit8 v2, v2, -0x1

    sub-int/2addr v2, v1

    aget-object v2, p1, v2

    aget-object v3, p1, v1

    aget v3, v3, v1

    aput v3, v2, v0

    .line 348
    add-int/lit8 v0, v0, 0x1

    goto :goto_24

    .line 346
    :cond_38
    add-int/lit8 v1, v1, 0x1

    goto :goto_1f

    .line 353
    :cond_3b
    const/4 v0, 0x0

    return-object v0
.end method