public SecT409FieldElement() { this.x = Nat448.create64(); }
public boolean equals(Object other) { if (other == this) { return true; } if (!(other instanceof SecT409FieldElement)) { return false; } SecT409FieldElement o = (SecT409FieldElement)other; return Nat448.eq64(x, o.x); }
public static long[] fromBigInteger(BigInteger x) { long[] z = Nat448.fromBigInteger64(x); reduce39(z, 0); return z; }
public static void multiply(long[] x, long[] y, long[] z) { long[] tt = Nat448.createExt64(); implMultiply(x, y, tt); reduce(tt, z); }
public boolean isOne() { return Nat448.isOne64(x); }
public boolean isZero() { return Nat448.isZero64(x); }
public BigInteger toBigInteger() { return Nat448.toBigInteger64(x); }
public static void multiplyAddToExt(long[] x, long[] y, long[] zz) { long[] tt = Nat448.createExt64(); implMultiply(x, y, tt); addExt(zz, tt, zz); }
public static long[] fromBigInteger64(BigInteger x) { if (x.signum() < 0 || x.bitLength() > 448) { 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 add(ECFieldElement b) { long[] z = Nat448.create64(); SecT409Field.add(x, ((SecT409FieldElement)b).x, z); return new SecT409FieldElement(z); }
public ECPoint lookup(int index) { long[] x = Nat448.create64(), y = Nat448.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 SecT409FieldElement(x), new SecT409FieldElement(y), false); } };
public ECFieldElement addOne() { long[] z = Nat448.create64(); SecT409Field.addOne(x, z); return new SecT409FieldElement(z); }
public ECFieldElement invert() { long[] z = Nat448.create64(); SecT409Field.invert(x, z); return new SecT409FieldElement(z); }
public ECFieldElement sqrt() { long[] z = Nat448.create64(); SecT409Field.sqrt(x, z); return new SecT409FieldElement(z); }
public ECPoint lookup(int index) { long[] x = Nat448.create64(), y = Nat448.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 SecT409FieldElement(x), new SecT409FieldElement(y), false); } };
public ECFieldElement multiply(ECFieldElement b) { long[] z = Nat448.create64(); SecT409Field.multiply(x, ((SecT409FieldElement)b).x, z); return new SecT409FieldElement(z); }
public ECFieldElement square() { long[] z = Nat448.create64(); SecT409Field.square(x, z); return new SecT409FieldElement(z); }