SecP256K1Field.smali

.class public Lorg/spongycastle/math/ec/custom/sec/SecP256K1Field;
.super Ljava/lang/Object;
.source "SecP256K1Field.java"


# static fields
.field static final P:[I

.field private static final P7:I = -0x1

.field static final PExt:[I

.field private static final PExt15:I = -0x1

.field private static final PExtInv:[I

.field private static final PInv33:I = 0x3d1


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

    .prologue
    .line 11
    const/16 v0, 0x8

    new-array v0, v0, [I

    fill-array-data v0, :array_1c

    sput-object v0, Lorg/spongycastle/math/ec/custom/sec/SecP256K1Field;->P:[I

    .line 13
    const/16 v0, 0x10

    new-array v0, v0, [I

    fill-array-data v0, :array_30

    sput-object v0, Lorg/spongycastle/math/ec/custom/sec/SecP256K1Field;->PExt:[I

    .line 16
    const/16 v0, 0xa

    new-array v0, v0, [I

    fill-array-data v0, :array_54

    sput-object v0, Lorg/spongycastle/math/ec/custom/sec/SecP256K1Field;->PExtInv:[I

    return-void

    .line 11
    :array_1c
    .array-data 4
        -0x3d1
        -0x2
        -0x1
        -0x1
        -0x1
        -0x1
        -0x1
        -0x1
    .end array-data

    .line 13
    :array_30
    .array-data 4
        0xe90a1
        0x7a2
        0x1
        0x0
        0x0
        0x0
        0x0
        0x0
        -0x7a2
        -0x3
        -0x1
        -0x1
        -0x1
        -0x1
        -0x1
        -0x1
    .end array-data

    .line 16
    :array_54
    .array-data 4
        -0xe90a1
        -0x7a3
        -0x2
        -0x1
        -0x1
        -0x1
        -0x1
        -0x1
        0x7a1
        0x2
    .end array-data
.end method

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

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

    return-void
.end method

.method public static add([I[I[I)V
    .registers 5

    .prologue
    .line 24
    invoke-static {p0, p1, p2}, Lorg/spongycastle/math/raw/Nat256;->add([I[I[I)I

    move-result v0

    .line 25
    if-nez v0, :cond_14

    const/4 v0, 0x7

    aget v0, p2, v0

    const/4 v1, -0x1

    if-ne v0, v1, :cond_1b

    sget-object v0, Lorg/spongycastle/math/ec/custom/sec/SecP256K1Field;->P:[I

    invoke-static {p2, v0}, Lorg/spongycastle/math/raw/Nat256;->gte([I[I)Z

    move-result v0

    if-eqz v0, :cond_1b

    .line 27
    :cond_14
    const/16 v0, 0x8

    const/16 v1, 0x3d1

    invoke-static {v0, v1, p2}, Lorg/spongycastle/math/raw/Nat;->add33To(II[I)I

    .line 29
    :cond_1b
    return-void
.end method

.method public static addExt([I[I[I)V
    .registers 6

    .prologue
    const/16 v2, 0x10

    .line 33
    invoke-static {v2, p0, p1, p2}, Lorg/spongycastle/math/raw/Nat;->add(I[I[I[I)I

    move-result v0

    .line 34
    if-nez v0, :cond_17

    const/16 v0, 0xf

    aget v0, p2, v0

    const/4 v1, -0x1

    if-ne v0, v1, :cond_28

    sget-object v0, Lorg/spongycastle/math/ec/custom/sec/SecP256K1Field;->PExt:[I

    invoke-static {v2, p2, v0}, Lorg/spongycastle/math/raw/Nat;->gte(I[I[I)Z

    move-result v0

    if-eqz v0, :cond_28

    .line 36
    :cond_17
    sget-object v0, Lorg/spongycastle/math/ec/custom/sec/SecP256K1Field;->PExtInv:[I

    array-length v0, v0

    sget-object v1, Lorg/spongycastle/math/ec/custom/sec/SecP256K1Field;->PExtInv:[I

    invoke-static {v0, v1, p2}, Lorg/spongycastle/math/raw/Nat;->addTo(I[I[I)I

    move-result v0

    if-eqz v0, :cond_28

    .line 38
    sget-object v0, Lorg/spongycastle/math/ec/custom/sec/SecP256K1Field;->PExtInv:[I

    array-length v0, v0

    invoke-static {v2, p2, v0}, Lorg/spongycastle/math/raw/Nat;->incAt(I[II)I

    .line 41
    :cond_28
    return-void
.end method

.method public static addOne([I[I)V
    .registers 5

    .prologue
    const/16 v2, 0x8

    .line 45
    invoke-static {v2, p0, p1}, Lorg/spongycastle/math/raw/Nat;->inc(I[I[I)I

    move-result v0

    .line 46
    if-nez v0, :cond_16

    const/4 v0, 0x7

    aget v0, p1, v0

    const/4 v1, -0x1

    if-ne v0, v1, :cond_1b

    sget-object v0, Lorg/spongycastle/math/ec/custom/sec/SecP256K1Field;->P:[I

    invoke-static {p1, v0}, Lorg/spongycastle/math/raw/Nat256;->gte([I[I)Z

    move-result v0

    if-eqz v0, :cond_1b

    .line 48
    :cond_16
    const/16 v0, 0x3d1

    invoke-static {v2, v0, p1}, Lorg/spongycastle/math/raw/Nat;->add33To(II[I)I

    .line 50
    :cond_1b
    return-void
.end method

.method public static fromBigInteger(Ljava/math/BigInteger;)[I
    .registers 4

    .prologue
    .line 54
    invoke-static {p0}, Lorg/spongycastle/math/raw/Nat256;->fromBigInteger(Ljava/math/BigInteger;)[I

    move-result-object v0

    .line 55
    const/4 v1, 0x7

    aget v1, v0, v1

    const/4 v2, -0x1

    if-ne v1, v2, :cond_17

    sget-object v1, Lorg/spongycastle/math/ec/custom/sec/SecP256K1Field;->P:[I

    invoke-static {v0, v1}, Lorg/spongycastle/math/raw/Nat256;->gte([I[I)Z

    move-result v1

    if-eqz v1, :cond_17

    .line 57
    sget-object v1, Lorg/spongycastle/math/ec/custom/sec/SecP256K1Field;->P:[I

    invoke-static {v1, v0}, Lorg/spongycastle/math/raw/Nat256;->subFrom([I[I)I

    .line 59
    :cond_17
    return-object v0
.end method

.method public static half([I[I)V
    .registers 5

    .prologue
    const/16 v2, 0x8

    const/4 v1, 0x0

    .line 64
    aget v0, p0, v1

    and-int/lit8 v0, v0, 0x1

    if-nez v0, :cond_d

    .line 66
    invoke-static {v2, p0, v1, p1}, Lorg/spongycastle/math/raw/Nat;->shiftDownBit(I[II[I)I

    .line 73
    :goto_c
    return-void

    .line 70
    :cond_d
    sget-object v0, Lorg/spongycastle/math/ec/custom/sec/SecP256K1Field;->P:[I

    invoke-static {p0, v0, p1}, Lorg/spongycastle/math/raw/Nat256;->add([I[I[I)I

    move-result v0

    .line 71
    invoke-static {v2, p1, v0}, Lorg/spongycastle/math/raw/Nat;->shiftDownBit(I[II)I

    goto :goto_c
.end method

.method public static multiply([I[I[I)V
    .registers 4

    .prologue
    .line 77
    invoke-static {}, Lorg/spongycastle/math/raw/Nat256;->createExt()[I

    move-result-object v0

    .line 78
    invoke-static {p0, p1, v0}, Lorg/spongycastle/math/raw/Nat256;->mul([I[I[I)V

    .line 79
    invoke-static {v0, p2}, Lorg/spongycastle/math/ec/custom/sec/SecP256K1Field;->reduce([I[I)V

    .line 80
    return-void
.end method

.method public static multiplyAddToExt([I[I[I)V
    .registers 6

    .prologue
    const/16 v2, 0x10

    .line 84
    invoke-static {p0, p1, p2}, Lorg/spongycastle/math/raw/Nat256;->mulAddTo([I[I[I)I

    move-result v0

    .line 85
    if-nez v0, :cond_17

    const/16 v0, 0xf

    aget v0, p2, v0

    const/4 v1, -0x1

    if-ne v0, v1, :cond_28

    sget-object v0, Lorg/spongycastle/math/ec/custom/sec/SecP256K1Field;->PExt:[I

    invoke-static {v2, p2, v0}, Lorg/spongycastle/math/raw/Nat;->gte(I[I[I)Z

    move-result v0

    if-eqz v0, :cond_28

    .line 87
    :cond_17
    sget-object v0, Lorg/spongycastle/math/ec/custom/sec/SecP256K1Field;->PExtInv:[I

    array-length v0, v0

    sget-object v1, Lorg/spongycastle/math/ec/custom/sec/SecP256K1Field;->PExtInv:[I

    invoke-static {v0, v1, p2}, Lorg/spongycastle/math/raw/Nat;->addTo(I[I[I)I

    move-result v0

    if-eqz v0, :cond_28

    .line 89
    sget-object v0, Lorg/spongycastle/math/ec/custom/sec/SecP256K1Field;->PExtInv:[I

    array-length v0, v0

    invoke-static {v2, p2, v0}, Lorg/spongycastle/math/raw/Nat;->incAt(I[II)I

    .line 92
    :cond_28
    return-void
.end method

.method public static negate([I[I)V
    .registers 3

    .prologue
    .line 96
    invoke-static {p0}, Lorg/spongycastle/math/raw/Nat256;->isZero([I)Z

    move-result v0

    if-eqz v0, :cond_a

    .line 98
    invoke-static {p1}, Lorg/spongycastle/math/raw/Nat256;->zero([I)V

    .line 104
    :goto_9
    return-void

    .line 102
    :cond_a
    sget-object v0, Lorg/spongycastle/math/ec/custom/sec/SecP256K1Field;->P:[I

    invoke-static {v0, p0, p1}, Lorg/spongycastle/math/raw/Nat256;->sub([I[I[I)I

    goto :goto_9
.end method

.method public static reduce([I[I)V
    .registers 10

    .prologue
    const/16 v2, 0x8

    const/16 v0, 0x3d1

    const/4 v4, 0x0

    .line 108
    move-object v1, p0

    move-object v3, p0

    move-object v5, p1

    move v6, v4

    invoke-static/range {v0 .. v6}, Lorg/spongycastle/math/raw/Nat256;->mul33Add(I[II[II[II)J

    move-result-wide v6

    .line 109
    invoke-static {v0, v6, v7, p1, v4}, Lorg/spongycastle/math/raw/Nat256;->mul33DWordAdd(IJ[II)I

    move-result v1

    .line 113
    if-nez v1, :cond_21

    const/4 v1, 0x7

    aget v1, p1, v1

    const/4 v3, -0x1

    if-ne v1, v3, :cond_24

    sget-object v1, Lorg/spongycastle/math/ec/custom/sec/SecP256K1Field;->P:[I

    invoke-static {p1, v1}, Lorg/spongycastle/math/raw/Nat256;->gte([I[I)Z

    move-result v1

    if-eqz v1, :cond_24

    .line 115
    :cond_21
    invoke-static {v2, v0, p1}, Lorg/spongycastle/math/raw/Nat;->add33To(II[I)I

    .line 117
    :cond_24
    return-void
.end method

.method public static reduce32(I[I)V
    .registers 5

    .prologue
    const/16 v2, 0x3d1

    .line 121
    if-eqz p0, :cond_b

    const/4 v0, 0x0

    invoke-static {v2, p0, p1, v0}, Lorg/spongycastle/math/raw/Nat256;->mul33WordAdd(II[II)I

    move-result v0

    if-nez v0, :cond_19

    :cond_b
    const/4 v0, 0x7

    aget v0, p1, v0

    const/4 v1, -0x1

    if-ne v0, v1, :cond_1e

    sget-object v0, Lorg/spongycastle/math/ec/custom/sec/SecP256K1Field;->P:[I

    .line 122
    invoke-static {p1, v0}, Lorg/spongycastle/math/raw/Nat256;->gte([I[I)Z

    move-result v0

    if-eqz v0, :cond_1e

    .line 124
    :cond_19
    const/16 v0, 0x8

    invoke-static {v0, v2, p1}, Lorg/spongycastle/math/raw/Nat;->add33To(II[I)I

    .line 126
    :cond_1e
    return-void
.end method

.method public static square([I[I)V
    .registers 3

    .prologue
    .line 130
    invoke-static {}, Lorg/spongycastle/math/raw/Nat256;->createExt()[I

    move-result-object v0

    .line 131
    invoke-static {p0, v0}, Lorg/spongycastle/math/raw/Nat256;->square([I[I)V

    .line 132
    invoke-static {v0, p1}, Lorg/spongycastle/math/ec/custom/sec/SecP256K1Field;->reduce([I[I)V

    .line 133
    return-void
.end method

.method public static squareN([II[I)V
    .registers 4

    .prologue
    .line 139
    invoke-static {}, Lorg/spongycastle/math/raw/Nat256;->createExt()[I

    move-result-object v0

    .line 140
    invoke-static {p0, v0}, Lorg/spongycastle/math/raw/Nat256;->square([I[I)V

    .line 141
    invoke-static {v0, p2}, Lorg/spongycastle/math/ec/custom/sec/SecP256K1Field;->reduce([I[I)V

    .line 143
    :goto_a
    add-int/lit8 p1, p1, -0x1

    if-lez p1, :cond_15

    .line 145
    invoke-static {p2, v0}, Lorg/spongycastle/math/raw/Nat256;->square([I[I)V

    .line 146
    invoke-static {v0, p2}, Lorg/spongycastle/math/ec/custom/sec/SecP256K1Field;->reduce([I[I)V

    goto :goto_a

    .line 148
    :cond_15
    return-void
.end method

.method public static subtract([I[I[I)V
    .registers 5

    .prologue
    .line 152
    invoke-static {p0, p1, p2}, Lorg/spongycastle/math/raw/Nat256;->sub([I[I[I)I

    move-result v0

    .line 153
    if-eqz v0, :cond_d

    .line 155
    const/16 v0, 0x8

    const/16 v1, 0x3d1

    invoke-static {v0, v1, p2}, Lorg/spongycastle/math/raw/Nat;->sub33From(II[I)I

    .line 157
    :cond_d
    return-void
.end method

.method public static subtractExt([I[I[I)V
    .registers 6

    .prologue
    const/16 v2, 0x10

    .line 161
    invoke-static {v2, p0, p1, p2}, Lorg/spongycastle/math/raw/Nat;->sub(I[I[I[I)I

    move-result v0

    .line 162
    if-eqz v0, :cond_19

    .line 164
    sget-object v0, Lorg/spongycastle/math/ec/custom/sec/SecP256K1Field;->PExtInv:[I

    array-length v0, v0

    sget-object v1, Lorg/spongycastle/math/ec/custom/sec/SecP256K1Field;->PExtInv:[I

    invoke-static {v0, v1, p2}, Lorg/spongycastle/math/raw/Nat;->subFrom(I[I[I)I

    move-result v0

    if-eqz v0, :cond_19

    .line 166
    sget-object v0, Lorg/spongycastle/math/ec/custom/sec/SecP256K1Field;->PExtInv:[I

    array-length v0, v0

    invoke-static {v2, p2, v0}, Lorg/spongycastle/math/raw/Nat;->decAt(I[II)I

    .line 169
    :cond_19
    return-void
.end method

.method public static twice([I[I)V
    .registers 5

    .prologue
    const/16 v2, 0x8

    .line 173
    const/4 v0, 0x0

    invoke-static {v2, p0, v0, p1}, Lorg/spongycastle/math/raw/Nat;->shiftUpBit(I[II[I)I

    move-result v0

    .line 174
    if-nez v0, :cond_17

    const/4 v0, 0x7

    aget v0, p1, v0

    const/4 v1, -0x1

    if-ne v0, v1, :cond_1c

    sget-object v0, Lorg/spongycastle/math/ec/custom/sec/SecP256K1Field;->P:[I

    invoke-static {p1, v0}, Lorg/spongycastle/math/raw/Nat256;->gte([I[I)Z

    move-result v0

    if-eqz v0, :cond_1c

    .line 176
    :cond_17
    const/16 v0, 0x3d1

    invoke-static {v2, v0, p1}, Lorg/spongycastle/math/raw/Nat;->add33To(II[I)I

    .line 178
    :cond_1c
    return-void
.end method