what-the-bank/sources/org/bouncycastle/pqc/crypto/rainbow/RainbowParameters.java

60 lines
1.5 KiB
Java
Raw Normal View History

2024-07-27 18:17:47 +07:00
package org.bouncycastle.pqc.crypto.rainbow;
import org.bouncycastle.crypto.CipherParameters;
/* loaded from: classes6.dex */
public class RainbowParameters implements CipherParameters {
private final int[] DEFAULT_VI;
private int[] vi;
public int[] getVi() {
return this.vi;
}
public int getNumOfLayers() {
return this.vi.length - 1;
}
public int getDocLength() {
int[] iArr = this.vi;
return iArr[iArr.length - 1] - iArr[0];
}
private void checkParams() throws Exception {
int[] iArr;
int i;
int[] iArr2 = this.vi;
if (iArr2 == null) {
throw new Exception("no layers defined.");
}
if (iArr2.length <= 1) {
throw new Exception("Rainbow needs at least 1 layer, such that v1 < v2.");
}
int i2 = 0;
do {
iArr = this.vi;
if (i2 >= iArr.length - 1) {
return;
}
i = iArr[i2];
i2++;
} while (i < iArr[i2]);
throw new Exception("v[i] has to be smaller than v[i+1]");
}
public RainbowParameters(int[] iArr) {
this.DEFAULT_VI = new int[]{6, 12, 17, 22, 33};
this.vi = iArr;
try {
checkParams();
} catch (Exception unused) {
}
}
public RainbowParameters() {
int[] iArr = {6, 12, 17, 22, 33};
this.DEFAULT_VI = iArr;
this.vi = iArr;
}
}