public boolean equals(Object other) { if (other == this) { return true; } if (!(other instanceof SecP384R1FieldElement)) { return false; } SecP384R1FieldElement o = (SecP384R1FieldElement)other; return Nat.eq(12, x, o.x); }
public boolean equals(Object other) { if (other == this) { return true; } if (!(other instanceof SecP384R1FieldElement)) { return false; } SecP384R1FieldElement o = (SecP384R1FieldElement)other; return Nat.eq(12, x, o.x); }
public boolean equals(Object other) { if (other == this) { return true; } if (!(other instanceof SecP521R1FieldElement)) { return false; } SecP521R1FieldElement o = (SecP521R1FieldElement)other; return Nat.eq(17, x, o.x); }
public boolean equals(Object other) { if (other == this) { return true; } if (!(other instanceof SecP521R1FieldElement)) { return false; } SecP521R1FieldElement o = (SecP521R1FieldElement)other; return Nat.eq(17, x, o.x); }
public static void add(int[] x, int[] y, int[] z) { int c = Nat.add(16, x, y, z) + x[16] + y[16]; if (c > P16 || (c == P16 && Nat.eq(16, z, P))) { c += Nat.inc(16, z); c &= P16; } z[16] = c; }
public static void add(int[] x, int[] y, int[] z) { int c = Nat.add(16, x, y, z) + x[16] + y[16]; if (c > P16 || (c == P16 && Nat.eq(16, z, P))) { c += Nat.inc(16, z); c &= P16; } z[16] = c; }
public static int[] fromBigInteger(BigInteger x) { int[] z = Nat.fromBigInteger(521, x); if (Nat.eq(17, z, P)) { Nat.zero(17, z); } return z; }
public static void addOne(int[] x, int[] z) { int c = Nat.inc(16, x, z) + x[16]; if (c > P16 || (c == P16 && Nat.eq(16, z, P))) { c += Nat.inc(16, z); c &= P16; } z[16] = c; }
public static int[] fromBigInteger(BigInteger x) { int[] z = Nat.fromBigInteger(521, x); if (Nat.eq(17, z, P)) { Nat.zero(17, z); } return z; }
public static void reduce23(int[] z) { int z16 = z[16]; int c = Nat.addWordTo(16, z16 >>> 9, z) + (z16 & P16); if (c > P16 || (c == P16 && Nat.eq(16, z, P))) { c += Nat.inc(16, z); c &= P16; } z[16] = c; }
public static void addOne(int[] x, int[] z) { int c = Nat.inc(16, x, z) + x[16]; if (c > P16 || (c == P16 && Nat.eq(16, z, P))) { c += Nat.inc(16, z); c &= P16; } z[16] = c; }
public static void reduce23(int[] z) { int z16 = z[16]; int c = Nat.addWordTo(16, z16 >>> 9, z) + (z16 & P16); if (c > P16 || (c == P16 && Nat.eq(16, z, P))) { c += Nat.inc(16, z); c &= P16; } z[16] = c; }
public static void reduce(int[] xx, int[] z) { // assert xx[32] >>> 18 == 0; int xx32 = xx[32]; int c = Nat.shiftDownBits(16, xx, 16, 9, xx32, z, 0) >>> 23; c += xx32 >>> 9; c += Nat.addTo(16, xx, z); if (c > P16 || (c == P16 && Nat.eq(16, z, P))) { c += Nat.inc(16, z); c &= P16; } z[16] = c; }
public static void reduce(int[] xx, int[] z) { // assert xx[32] >>> 18 == 0; int xx32 = xx[32]; int c = Nat.shiftDownBits(16, xx, 16, 9, xx32, z, 0) >>> 23; c += xx32 >>> 9; c += Nat.addTo(16, xx, z); if (c > P16 || (c == P16 && Nat.eq(16, z, P))) { c += Nat.inc(16, z); c &= P16; } z[16] = c; }
/** * return a sqrt root - the routine verifies that the calculation returns the right value - if * none exists it returns null. */ public ECFieldElement sqrt() { // Raise this element to the exponent 2^519 int[] x1 = this.x; if (Nat.isZero(17, x1) || Nat.isOne(17, x1)) { return this; } int[] t1 = Nat.create(17); int[] t2 = Nat.create(17); SecP521R1Field.squareN(x1, 519, t1); SecP521R1Field.square(t1, t2); return Nat.eq(17, x1, t2) ? new SecP521R1FieldElement(t1) : null; }
/** * return a sqrt root - the routine verifies that the calculation returns the right value - if * none exists it returns null. */ public ECFieldElement sqrt() { // Raise this element to the exponent 2^519 int[] x1 = this.x; if (Nat.isZero(17, x1) || Nat.isOne(17, x1)) { return this; } int[] t1 = Nat.create(17); int[] t2 = Nat.create(17); SecP521R1Field.squareN(x1, 519, t1); SecP521R1Field.square(t1, t2); return Nat.eq(17, x1, t2) ? new SecP521R1FieldElement(t1) : null; }
SecP384R1Field.square(t1, t2); return Nat.eq(12, x1, t2) ? new SecP384R1FieldElement(t1) : null;
SecP384R1Field.square(t1, t2); return Nat.eq(12, x1, t2) ? new SecP384R1FieldElement(t1) : null;