PointEd25519 extends Point { @Override public final Point add(Point point) { Coordinate x1 = this.x; Coordinate y1 = this.y; Coordinate z1 = this.z; Coordinate t1 = this.t; Coordinate x2 = point.getX(); Coordinate y2 = point.getY(); Coordinate z2 = point.getZ(); Coordinate t2 = point.getT(); Coordinate d = new CoordinateEd25519(curve.getD().getInteger()); Coordinate coord2 = new CoordinateEd25519(BigInteger.ONE.shiftLeft(1)); Coordinate A = y1.subtract(x1).multiply(y2.subtract(x2)).mod(); Coordinate B = y1.add(x1).multiply(y2.add(x2)).mod(); Coordinate C = t1.multiply(coord2).multiply(d).multiply(t2).mod(); Coordinate D = z1.multiply(coord2).multiply(z2).mod(); Coordinate E = B.subtract(A).mod(); Coordinate F = D.subtract(C).mod(); Coordinate G = D.add(C).mod(); Coordinate H = B.add(A).mod(); Coordinate x3 = E.multiply(F).mod(); Coordinate y3 = G.multiply(H).mod(); Coordinate t3 = E.multiply(H).mod(); Coordinate z3 = F.multiply(G).mod(); return new PointEd25519(x3, y3, z3, t3); } PointEd25519(Coordinate x, Coordinate y, Coordinate z, Coordinate t); static PointEd25519 fromAffine(Coordinate x, Coordinate y); @Override final Point add(Point point); @Override Point doubling(); @Override final Point scalarMultiply(BigInteger integer); @Override Point negateY(); @Override final EncodedPoint encode(); @Override Point negate();  }
@Test public void success_AddBasePoint() { Point doubled = curve.getBasePoint().add(curve.getBasePoint()); assertThat(doubled.getAffineX().getInteger(), is(new BigInteger("24727413235106541002554574571675588834622768167397638456726423682521233608206"))); assertThat(doubled.getAffineY().getInteger(), is(new BigInteger("15549675580280190176352668710449542251549572066445060580507079593062643049417"))); }
@Test public void success_MultiOperation_1() { BigInteger k = new BigInteger("6075980004175535879679826160500264550302046044703001554511768035174960884068121242792397217197363038097667151841372253838835089167259419742248753963346391"); BigInteger r = new BigInteger("7368313437276165600538158652835868406847530051071893351052927312315159593412414852560947822723289365893543058291013782043548190862352985926994804682235672"); BigInteger s = new BigInteger("45574626401593346369382133240842874906163693510868742802398980918235613620592"); BigInteger result = k.mod(curve.getPrimeL()).multiply(s).add(r).mod(curve.getPrimeL()); assertThat(result, is(new BigInteger("319146615599574595135908926944340520491598694492366832960461172005503422390"))); }