public SecT283FieldElement() { this.x = Nat320.create64(); }
public boolean equals(Object other) { if (other == this) { return true; } if (!(other instanceof SecT283FieldElement)) { return false; } SecT283FieldElement o = (SecT283FieldElement)other; return Nat320.eq64(x, o.x); }
public static long[] fromBigInteger(BigInteger x) { long[] z = Nat320.fromBigInteger64(x); reduce37(z, 0); return z; }
public static void multiply(long[] x, long[] y, long[] z) { long[] tt = Nat320.createExt64(); implMultiply(x, y, tt); reduce(tt, z); }
public boolean isZero() { return Nat320.isZero64(x); }
public boolean isOne() { return Nat320.isOne64(x); }
public BigInteger toBigInteger() { return Nat320.toBigInteger64(x); }
public static void multiplyAddToExt(long[] x, long[] y, long[] zz) { long[] tt = Nat320.createExt64(); implMultiply(x, y, tt); addExt(zz, tt, zz); }
public static long[] fromBigInteger64(BigInteger x) { if (x.signum() < 0 || x.bitLength() > 320) { throw new IllegalArgumentException(); } long[] z = create64(); int i = 0; while (x.signum() != 0) { z[i++] = x.longValue(); x = x.shiftRight(64); } return z; }
public ECFieldElement addOne() { long[] z = Nat320.create64(); SecT283Field.addOne(x, z); return new SecT283FieldElement(z); }
public ECFieldElement multiply(ECFieldElement b) { long[] z = Nat320.create64(); SecT283Field.multiply(x, ((SecT283FieldElement)b).x, z); return new SecT283FieldElement(z); }
public ECFieldElement invert() { long[] z = Nat320.create64(); SecT283Field.invert(x, z); return new SecT283FieldElement(z); }
public ECPoint lookup(int index) { long[] x = Nat320.create64(), y = Nat320.create64(); int pos = 0; for (int i = 0; i < len; ++i) { long MASK = ((i ^ index) - 1) >> 31; for (int j = 0; j < FE_LONGS; ++j) { x[j] ^= table[pos + j] & MASK; y[j] ^= table[pos + FE_LONGS + j] & MASK; } pos += (FE_LONGS * 2); } return createRawPoint(new SecT283FieldElement(x), new SecT283FieldElement(y), false); } };
public ECPoint lookup(int index) { long[] x = Nat320.create64(), y = Nat320.create64(); int pos = 0; for (int i = 0; i < len; ++i) { long MASK = ((i ^ index) - 1) >> 31; for (int j = 0; j < FE_LONGS; ++j) { x[j] ^= table[pos + j] & MASK; y[j] ^= table[pos + FE_LONGS + j] & MASK; } pos += (FE_LONGS * 2); } return createRawPoint(new SecT283FieldElement(x), new SecT283FieldElement(y), false); } };
public ECFieldElement square() { long[] z = Nat320.create64(); SecT283Field.square(x, z); return new SecT283FieldElement(z); }
public ECFieldElement add(ECFieldElement b) { long[] z = Nat320.create64(); SecT283Field.add(x, ((SecT283FieldElement)b).x, z); return new SecT283FieldElement(z); }
public ECFieldElement squarePow(int pow) { if (pow < 1) { return this; } long[] z = Nat320.create64(); SecT283Field.squareN(x, pow, z); return new SecT283FieldElement(z); }