@Test public void success_ScalarMultiplyBasePoint_50459379271018302582465998844449622265826330103819895252966304478993432089656() { Point scalard = curve.getBasePoint().scalarMultiply(new BigInteger("50459379271018302582465998844449622265826330103819895252966304478993432089656")); assertThat(scalard.getAffineX().getInteger(), is(new BigInteger("15803359856018908320086002332714894013924030585248052893900291221487236226419"))); assertThat(scalard.getAffineY().getInteger(), is(new BigInteger("25416682171142283067951549518103646638934086440885266225724336361653813092611"))); }
@Override public final Point scalarMultiply(BigInteger integer) { if (integer.equals(BigInteger.ZERO)) { return PointEd25519.O; } Point[] qs = new Point[]{O, O}; Point[] rs = new Point[]{this, this, negateY()}; int[] signedBin = ArrayUtils.toMutualOppositeForm(integer); for (int aSignedBin : signedBin) { qs[0] = qs[0].doubling(); qs[1] = qs[0].add(rs[1 - aSignedBin]).negate(); qs[0] = qs[(aSignedBin ^ (aSignedBin >> 31)) - (aSignedBin >> 31)]; } return qs[0]; }
PointEd25519 extends Point { @Override public final Point scalarMultiply(BigInteger integer) { if (integer.equals(BigInteger.ZERO)) { return PointEd25519.O; } Point[] qs = new Point[]{O, O}; Point[] rs = new Point[]{this, this, negateY()}; int[] signedBin = ArrayUtils.toMutualOppositeForm(integer); for (int aSignedBin : signedBin) { qs[0] = qs[0].doubling(); qs[1] = qs[0].add(rs[1 - aSignedBin]).negate(); qs[0] = qs[(aSignedBin ^ (aSignedBin >> 31)) - (aSignedBin >> 31)]; } return qs[0]; } }
PointEd25519 extends Point { @Override public final Point scalarMultiply(BigInteger integer) { if (integer.equals(BigInteger.ZERO)) { return PointEd25519.O; } Point[] qs = new Point[]{O, O}; Point[] rs = new Point[]{this, this, negateY()}; int[] signedBin = ArrayUtils.toMutualOppositeForm(integer); for (int aSignedBin : signedBin) { qs[0] = qs[0].doubling(); qs[1] = qs[0].add(rs[1 - aSignedBin]).negate(); qs[0] = qs[(aSignedBin ^ (aSignedBin >> 31)) - (aSignedBin >> 31)]; } return qs[0]; } PointEd25519(Coordinate x, Coordinate y, Coordinate z, Coordinate t); }
PointEd25519 extends Point { @Override public final Point scalarMultiply(BigInteger integer) { if (integer.equals(BigInteger.ZERO)) { return PointEd25519.O; } Point[] qs = new Point[]{O, O}; Point[] rs = new Point[]{this, this, negateY()}; int[] signedBin = ArrayUtils.toMutualOppositeForm(integer); for (int aSignedBin : signedBin) { qs[0] = qs[0].doubling(); qs[1] = qs[0].add(rs[1 - aSignedBin]).negate(); qs[0] = qs[(aSignedBin ^ (aSignedBin >> 31)) - (aSignedBin >> 31)]; } return qs[0]; } 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(); }
PointEd25519 extends Point { @Override public final Point scalarMultiply(BigInteger integer) { if (integer.equals(BigInteger.ZERO)) { return PointEd25519.O; } Point[] qs = new Point[]{O, O}; Point[] rs = new Point[]{this, this, negateY()}; int[] signedBin = ArrayUtils.toMutualOppositeForm(integer); for (int aSignedBin : signedBin) { qs[0] = qs[0].doubling(); qs[1] = qs[0].add(rs[1 - aSignedBin]).negate(); qs[0] = qs[(aSignedBin ^ (aSignedBin >> 31)) - (aSignedBin >> 31)]; } return qs[0]; } 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();  }