what-the-bank/sources/org/bouncycastle/math/ec/custom/djb/Curve25519.java

65 lines
2.3 KiB
Java

package org.bouncycastle.math.ec.custom.djb;
import java.math.BigInteger;
import org.bouncycastle.math.ec.ECCurve;
import org.bouncycastle.math.ec.ECFieldElement;
import org.bouncycastle.math.ec.ECPoint;
import org.bouncycastle.math.raw.Nat256;
import org.bouncycastle.util.encoders.Hex;
/* loaded from: classes6.dex */
public class Curve25519 extends ECCurve.AbstractFp {
private static final int Curve25519_DEFAULT_COORDS = 4;
public static final BigInteger q = Nat256.toBigInteger(Curve25519Field.P);
protected Curve25519Point infinity;
@Override // org.bouncycastle.math.ec.ECCurve
public boolean supportsCoordinateSystem(int i) {
return i == 4;
}
public BigInteger getQ() {
return q;
}
@Override // org.bouncycastle.math.ec.ECCurve
public ECPoint getInfinity() {
return this.infinity;
}
@Override // org.bouncycastle.math.ec.ECCurve
public int getFieldSize() {
return q.bitLength();
}
@Override // org.bouncycastle.math.ec.ECCurve
public ECFieldElement fromBigInteger(BigInteger bigInteger) {
return new Curve25519FieldElement(bigInteger);
}
@Override // org.bouncycastle.math.ec.ECCurve
public ECPoint createRawPoint(ECFieldElement eCFieldElement, ECFieldElement eCFieldElement2, ECFieldElement[] eCFieldElementArr, boolean z) {
return new Curve25519Point(this, eCFieldElement, eCFieldElement2, eCFieldElementArr, z);
}
@Override // org.bouncycastle.math.ec.ECCurve
public ECPoint createRawPoint(ECFieldElement eCFieldElement, ECFieldElement eCFieldElement2, boolean z) {
return new Curve25519Point(this, eCFieldElement, eCFieldElement2, z);
}
@Override // org.bouncycastle.math.ec.ECCurve
public ECCurve cloneCurve() {
return new Curve25519();
}
public Curve25519() {
super(q);
this.infinity = new Curve25519Point(this, null, null);
this.a = fromBigInteger(new BigInteger(1, Hex.decode("2AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA984914A144")));
this.b = fromBigInteger(new BigInteger(1, Hex.decode("7B425ED097B425ED097B425ED097B425ED097B425ED097B4260B5E9C7710C864")));
this.order = new BigInteger(1, Hex.decode("1000000000000000000000000000000014DEF9DEA2F79CD65812631A5CF5D3ED"));
this.cofactor = BigInteger.valueOf(8L);
this.coord = 4;
}
}