GF2mVector.smali
.class public Lorg/spongycastle/pqc/math/linearalgebra/GF2mVector;
.super Lorg/spongycastle/pqc/math/linearalgebra/Vector;
.source "GF2mVector.java"
# instance fields
.field private field:Lorg/spongycastle/pqc/math/linearalgebra/GF2mField;
.field private vector:[I
# direct methods
.method public constructor <init>(Lorg/spongycastle/pqc/math/linearalgebra/GF2mField;[B)V
.registers 11
.prologue
const/4 v2, 0x0
.line 31
invoke-direct {p0}, Lorg/spongycastle/pqc/math/linearalgebra/Vector;-><init>()V
.line 32
new-instance v0, Lorg/spongycastle/pqc/math/linearalgebra/GF2mField;
invoke-direct {v0, p1}, Lorg/spongycastle/pqc/math/linearalgebra/GF2mField;-><init>(Lorg/spongycastle/pqc/math/linearalgebra/GF2mField;)V
iput-object v0, p0, Lorg/spongycastle/pqc/math/linearalgebra/GF2mVector;->field:Lorg/spongycastle/pqc/math/linearalgebra/GF2mField;
.line 35
const/16 v1, 0x8
.line 36
const/4 v0, 0x1
.line 37
:goto_e
invoke-virtual {p1}, Lorg/spongycastle/pqc/math/linearalgebra/GF2mField;->getDegree()I
move-result v3
if-le v3, v1, :cond_19
.line 39
add-int/lit8 v0, v0, 0x1
.line 40
add-int/lit8 v1, v1, 0x8
goto :goto_e
.line 43
:cond_19
array-length v3, p2
rem-int/2addr v3, v0
if-eqz v3, :cond_25
.line 45
new-instance v0, Ljava/lang/IllegalArgumentException;
const-string v1, "Byte array is not an encoded vector over the given finite field."
invoke-direct {v0, v1}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
throw v0
.line 49
:cond_25
array-length v3, p2
div-int v0, v3, v0
iput v0, p0, Lorg/spongycastle/pqc/math/linearalgebra/GF2mVector;->length:I
.line 50
iget v0, p0, Lorg/spongycastle/pqc/math/linearalgebra/GF2mVector;->length:I
new-array v0, v0, [I
iput-object v0, p0, Lorg/spongycastle/pqc/math/linearalgebra/GF2mVector;->vector:[I
move v0, v2
move v3, v2
.line 52
:goto_32
iget-object v4, p0, Lorg/spongycastle/pqc/math/linearalgebra/GF2mVector;->vector:[I
array-length v4, v4
if-ge v0, v4, :cond_62
move v4, v2
.line 54
:goto_38
if-ge v4, v1, :cond_4d
.line 56
iget-object v6, p0, Lorg/spongycastle/pqc/math/linearalgebra/GF2mVector;->vector:[I
aget v7, v6, v0
add-int/lit8 v5, v3, 0x1
aget-byte v3, p2, v3
and-int/lit16 v3, v3, 0xff
shl-int/2addr v3, v4
or-int/2addr v3, v7
aput v3, v6, v0
.line 54
add-int/lit8 v3, v4, 0x8
move v4, v3
move v3, v5
goto :goto_38
.line 58
:cond_4d
iget-object v4, p0, Lorg/spongycastle/pqc/math/linearalgebra/GF2mVector;->vector:[I
aget v4, v4, v0
invoke-virtual {p1, v4}, Lorg/spongycastle/pqc/math/linearalgebra/GF2mField;->isElementOfThisField(I)Z
move-result v4
if-nez v4, :cond_5f
.line 60
new-instance v0, Ljava/lang/IllegalArgumentException;
const-string v1, "Byte array is not an encoded vector over the given finite field."
invoke-direct {v0, v1}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
throw v0
.line 52
:cond_5f
add-int/lit8 v0, v0, 0x1
goto :goto_32
.line 64
:cond_62
return-void
.end method
.method public constructor <init>(Lorg/spongycastle/pqc/math/linearalgebra/GF2mField;[I)V
.registers 5
.prologue
.line 74
invoke-direct {p0}, Lorg/spongycastle/pqc/math/linearalgebra/Vector;-><init>()V
.line 75
iput-object p1, p0, Lorg/spongycastle/pqc/math/linearalgebra/GF2mVector;->field:Lorg/spongycastle/pqc/math/linearalgebra/GF2mField;
.line 76
array-length v0, p2
iput v0, p0, Lorg/spongycastle/pqc/math/linearalgebra/GF2mVector;->length:I
.line 77
array-length v0, p2
add-int/lit8 v0, v0, -0x1
:goto_b
if-ltz v0, :cond_20
.line 79
aget v1, p2, v0
invoke-virtual {p1, v1}, Lorg/spongycastle/pqc/math/linearalgebra/GF2mField;->isElementOfThisField(I)Z
move-result v1
if-nez v1, :cond_1d
.line 81
new-instance v0, Ljava/lang/ArithmeticException;
const-string v1, "Element array is not specified over the given finite field."
invoke-direct {v0, v1}, Ljava/lang/ArithmeticException;-><init>(Ljava/lang/String;)V
throw v0
.line 77
:cond_1d
add-int/lit8 v0, v0, -0x1
goto :goto_b
.line 85
:cond_20
invoke-static {p2}, Lorg/spongycastle/pqc/math/linearalgebra/IntUtils;->clone([I)[I
move-result-object v0
iput-object v0, p0, Lorg/spongycastle/pqc/math/linearalgebra/GF2mVector;->vector:[I
.line 86
return-void
.end method
.method public constructor <init>(Lorg/spongycastle/pqc/math/linearalgebra/GF2mVector;)V
.registers 4
.prologue
.line 94
invoke-direct {p0}, Lorg/spongycastle/pqc/math/linearalgebra/Vector;-><init>()V
.line 95
new-instance v0, Lorg/spongycastle/pqc/math/linearalgebra/GF2mField;
iget-object v1, p1, Lorg/spongycastle/pqc/math/linearalgebra/GF2mVector;->field:Lorg/spongycastle/pqc/math/linearalgebra/GF2mField;
invoke-direct {v0, v1}, Lorg/spongycastle/pqc/math/linearalgebra/GF2mField;-><init>(Lorg/spongycastle/pqc/math/linearalgebra/GF2mField;)V
iput-object v0, p0, Lorg/spongycastle/pqc/math/linearalgebra/GF2mVector;->field:Lorg/spongycastle/pqc/math/linearalgebra/GF2mField;
.line 96
iget v0, p1, Lorg/spongycastle/pqc/math/linearalgebra/GF2mVector;->length:I
iput v0, p0, Lorg/spongycastle/pqc/math/linearalgebra/GF2mVector;->length:I
.line 97
iget-object v0, p1, Lorg/spongycastle/pqc/math/linearalgebra/GF2mVector;->vector:[I
invoke-static {v0}, Lorg/spongycastle/pqc/math/linearalgebra/IntUtils;->clone([I)[I
move-result-object v0
iput-object v0, p0, Lorg/spongycastle/pqc/math/linearalgebra/GF2mVector;->vector:[I
.line 98
return-void
.end method
# virtual methods
.method public add(Lorg/spongycastle/pqc/math/linearalgebra/Vector;)Lorg/spongycastle/pqc/math/linearalgebra/Vector;
.registers 4
.prologue
.line 169
new-instance v0, Ljava/lang/RuntimeException;
const-string v1, "not implemented"
invoke-direct {v0, v1}, Ljava/lang/RuntimeException;-><init>(Ljava/lang/String;)V
throw v0
.end method
.method public equals(Ljava/lang/Object;)Z
.registers 5
.prologue
const/4 v0, 0x0
.line 205
instance-of v1, p1, Lorg/spongycastle/pqc/math/linearalgebra/GF2mVector;
if-nez v1, :cond_6
.line 216
:cond_5
:goto_5
return v0
.line 209
:cond_6
check-cast p1, Lorg/spongycastle/pqc/math/linearalgebra/GF2mVector;
.line 211
iget-object v1, p0, Lorg/spongycastle/pqc/math/linearalgebra/GF2mVector;->field:Lorg/spongycastle/pqc/math/linearalgebra/GF2mField;
iget-object v2, p1, Lorg/spongycastle/pqc/math/linearalgebra/GF2mVector;->field:Lorg/spongycastle/pqc/math/linearalgebra/GF2mField;
invoke-virtual {v1, v2}, Lorg/spongycastle/pqc/math/linearalgebra/GF2mField;->equals(Ljava/lang/Object;)Z
move-result v1
if-eqz v1, :cond_5
.line 216
iget-object v0, p0, Lorg/spongycastle/pqc/math/linearalgebra/GF2mVector;->vector:[I
iget-object v1, p1, Lorg/spongycastle/pqc/math/linearalgebra/GF2mVector;->vector:[I
invoke-static {v0, v1}, Lorg/spongycastle/pqc/math/linearalgebra/IntUtils;->equals([I[I)Z
move-result v0
goto :goto_5
.end method
.method public getEncoded()[B
.registers 9
.prologue
const/4 v2, 0x0
.line 121
const/16 v1, 0x8
.line 122
const/4 v0, 0x1
.line 123
:goto_4
iget-object v3, p0, Lorg/spongycastle/pqc/math/linearalgebra/GF2mVector;->field:Lorg/spongycastle/pqc/math/linearalgebra/GF2mField;
invoke-virtual {v3}, Lorg/spongycastle/pqc/math/linearalgebra/GF2mField;->getDegree()I
move-result v3
if-le v3, v1, :cond_11
.line 125
add-int/lit8 v0, v0, 0x1
.line 126
add-int/lit8 v1, v1, 0x8
goto :goto_4
.line 129
:cond_11
iget-object v3, p0, Lorg/spongycastle/pqc/math/linearalgebra/GF2mVector;->vector:[I
array-length v3, v3
mul-int/2addr v0, v3
new-array v6, v0, [B
move v0, v2
move v3, v2
.line 131
:goto_19
iget-object v4, p0, Lorg/spongycastle/pqc/math/linearalgebra/GF2mVector;->vector:[I
array-length v4, v4
if-ge v0, v4, :cond_33
move v4, v2
.line 133
:goto_1f
if-ge v4, v1, :cond_30
.line 135
add-int/lit8 v5, v3, 0x1
iget-object v7, p0, Lorg/spongycastle/pqc/math/linearalgebra/GF2mVector;->vector:[I
aget v7, v7, v0
ushr-int/2addr v7, v4
int-to-byte v7, v7
aput-byte v7, v6, v3
.line 133
add-int/lit8 v3, v4, 0x8
move v4, v3
move v3, v5
goto :goto_1f
.line 131
:cond_30
add-int/lit8 v0, v0, 0x1
goto :goto_19
.line 139
:cond_33
return-object v6
.end method
.method public getField()Lorg/spongycastle/pqc/math/linearalgebra/GF2mField;
.registers 2
.prologue
.line 105
iget-object v0, p0, Lorg/spongycastle/pqc/math/linearalgebra/GF2mVector;->field:Lorg/spongycastle/pqc/math/linearalgebra/GF2mField;
return-object v0
.end method
.method public getIntArrayForm()[I
.registers 2
.prologue
.line 113
iget-object v0, p0, Lorg/spongycastle/pqc/math/linearalgebra/GF2mVector;->vector:[I
invoke-static {v0}, Lorg/spongycastle/pqc/math/linearalgebra/IntUtils;->clone([I)[I
move-result-object v0
return-object v0
.end method
.method public hashCode()I
.registers 3
.prologue
.line 224
iget-object v0, p0, Lorg/spongycastle/pqc/math/linearalgebra/GF2mVector;->field:Lorg/spongycastle/pqc/math/linearalgebra/GF2mField;
invoke-virtual {v0}, Lorg/spongycastle/pqc/math/linearalgebra/GF2mField;->hashCode()I
move-result v0
.line 225
mul-int/lit8 v0, v0, 0x1f
iget-object v1, p0, Lorg/spongycastle/pqc/math/linearalgebra/GF2mVector;->vector:[I
invoke-virtual {v1}, Ljava/lang/Object;->hashCode()I
move-result v1
add-int/2addr v0, v1
.line 226
return v0
.end method
.method public isZero()Z
.registers 3
.prologue
.line 147
iget-object v0, p0, Lorg/spongycastle/pqc/math/linearalgebra/GF2mVector;->vector:[I
array-length v0, v0
add-int/lit8 v0, v0, -0x1
:goto_5
if-ltz v0, :cond_12
.line 149
iget-object v1, p0, Lorg/spongycastle/pqc/math/linearalgebra/GF2mVector;->vector:[I
aget v1, v1, v0
if-eqz v1, :cond_f
.line 151
const/4 v0, 0x0
.line 154
:goto_e
return v0
.line 147
:cond_f
add-int/lit8 v0, v0, -0x1
goto :goto_5
.line 154
:cond_12
const/4 v0, 0x1
goto :goto_e
.end method
.method public multiply(Lorg/spongycastle/pqc/math/linearalgebra/Permutation;)Lorg/spongycastle/pqc/math/linearalgebra/Vector;
.registers 7
.prologue
.line 180
invoke-virtual {p1}, Lorg/spongycastle/pqc/math/linearalgebra/Permutation;->getVector()[I
move-result-object v1
.line 181
iget v0, p0, Lorg/spongycastle/pqc/math/linearalgebra/GF2mVector;->length:I
array-length v2, v1
if-eq v0, v2, :cond_11
.line 183
new-instance v0, Ljava/lang/ArithmeticException;
const-string v1, "permutation size and vector size mismatch"
invoke-direct {v0, v1}, Ljava/lang/ArithmeticException;-><init>(Ljava/lang/String;)V
throw v0
.line 187
:cond_11
iget v0, p0, Lorg/spongycastle/pqc/math/linearalgebra/GF2mVector;->length:I
new-array v2, v0, [I
.line 188
const/4 v0, 0x0
:goto_16
array-length v3, v1
if-ge v0, v3, :cond_24
.line 190
iget-object v3, p0, Lorg/spongycastle/pqc/math/linearalgebra/GF2mVector;->vector:[I
aget v4, v1, v0
aget v3, v3, v4
aput v3, v2, v0
.line 188
add-int/lit8 v0, v0, 0x1
goto :goto_16
.line 193
:cond_24
new-instance v0, Lorg/spongycastle/pqc/math/linearalgebra/GF2mVector;
iget-object v1, p0, Lorg/spongycastle/pqc/math/linearalgebra/GF2mVector;->field:Lorg/spongycastle/pqc/math/linearalgebra/GF2mField;
invoke-direct {v0, v1, v2}, Lorg/spongycastle/pqc/math/linearalgebra/GF2mVector;-><init>(Lorg/spongycastle/pqc/math/linearalgebra/GF2mField;[I)V
return-object v0
.end method
.method public toString()Ljava/lang/String;
.registers 7
.prologue
const/4 v1, 0x0
.line 234
new-instance v3, Ljava/lang/StringBuffer;
invoke-direct {v3}, Ljava/lang/StringBuffer;-><init>()V
move v0, v1
.line 235
:goto_7
iget-object v2, p0, Lorg/spongycastle/pqc/math/linearalgebra/GF2mVector;->vector:[I
array-length v2, v2
if-ge v0, v2, :cond_37
move v2, v1
.line 237
:goto_d
iget-object v4, p0, Lorg/spongycastle/pqc/math/linearalgebra/GF2mVector;->field:Lorg/spongycastle/pqc/math/linearalgebra/GF2mField;
invoke-virtual {v4}, Lorg/spongycastle/pqc/math/linearalgebra/GF2mField;->getDegree()I
move-result v4
if-ge v2, v4, :cond_2f
.line 239
and-int/lit8 v4, v2, 0x1f
.line 240
const/4 v5, 0x1
shl-int v4, v5, v4
.line 241
iget-object v5, p0, Lorg/spongycastle/pqc/math/linearalgebra/GF2mVector;->vector:[I
aget v5, v5, v0
and-int/2addr v4, v5
.line 242
if-eqz v4, :cond_29
.line 244
const/16 v4, 0x31
invoke-virtual {v3, v4}, Ljava/lang/StringBuffer;->append(C)Ljava/lang/StringBuffer;
.line 237
:goto_26
add-int/lit8 v2, v2, 0x1
goto :goto_d
.line 248
:cond_29
const/16 v4, 0x30
invoke-virtual {v3, v4}, Ljava/lang/StringBuffer;->append(C)Ljava/lang/StringBuffer;
goto :goto_26
.line 251
:cond_2f
const/16 v2, 0x20
invoke-virtual {v3, v2}, Ljava/lang/StringBuffer;->append(C)Ljava/lang/StringBuffer;
.line 235
add-int/lit8 v0, v0, 0x1
goto :goto_7
.line 253
:cond_37
invoke-virtual {v3}, Ljava/lang/StringBuffer;->toString()Ljava/lang/String;
move-result-object v0
return-object v0
.end method