@Test
  public void testUnmodifiedKey() throws Exception {
    byte[] privateKey = Random.randBytes(Field25519.FIELD_LEN);
    byte[] hashedPrivateKey = Ed25519.getHashedScalar(privateKey);
    byte[] originalHashedPrivateKey =
        Arrays.copyOfRange(hashedPrivateKey, 0, hashedPrivateKey.length);
    byte[] publicKey = Ed25519.scalarMultWithBaseToBytes(hashedPrivateKey);
    byte[] originalPublicKey = Arrays.copyOfRange(publicKey, 0, publicKey.length);
    for (int i = 0; i < 64; i++) {
      byte[] msg = Random.randBytes(1024);
      byte[] sig = Ed25519.sign(msg, publicKey, hashedPrivateKey);
      assertTrue(Ed25519.verify(msg, sig, publicKey));
      assertArrayEquals(originalHashedPrivateKey, hashedPrivateKey);
      assertArrayEquals(originalPublicKey, publicKey);
    }
  }
Test whether sign/verify method accidentally changes the public key or hashedPrivateKey.
java_src/src/test/java/com/google/crypto/tink/internal/Ed25519Test.java