/** Test method for {@link GroupElement#select(int, int)}. */ @Test public void testSelect() { GroupElement B = ed25519.getB(); for (int i = 0; i < 32; i++) { // 16^i 0 B assertThat( i + ",0", B.select(i, 0), is(equalTo(GroupElement.precomp(curve, ONE, ONE, ZERO)))); for (int j = 1; j < 8; j++) { // 16^i r_i B GroupElement t = B.select(i, j); assertThat(i + "," + j, t, is(equalTo(B.precmp[i][j - 1]))); // -16^i r_i B t = B.select(i, -j); GroupElement neg = GroupElement.precomp( curve, B.precmp[i][j - 1].Y, B.precmp[i][j - 1].X, B.precmp[i][j - 1].Z.negate()); assertThat(i + "," + -j, t, is(equalTo(neg))); } } }