public static boolean verify(final byte[] message, final byte[] signature, final byte[] publicKey)
      throws GeneralSecurityException {
    if (signature.length != SIGNATURE_LEN) {
      return false;
    }
    byte[] s = Arrays.copyOfRange(signature, Field25519.FIELD_LEN, SIGNATURE_LEN);
    if (!isSmallerThanGroupOrder(s)) {
      return false;
    }
    MessageDigest digest = EngineFactory.MESSAGE_DIGEST.getInstance("SHA-512");
    digest.update(signature, 0, Field25519.FIELD_LEN);
    digest.update(publicKey);
    digest.update(message);
    byte[] h = digest.digest();
    reduce(h);

    XYZT negPublicKey = XYZT.fromBytesNegateVarTime(publicKey);
    XYZ xyz = doubleScalarMultVarTime(h, negPublicKey, s);
    byte[] expectedR = xyz.toBytes();
    for (int i = 0; i < Field25519.FIELD_LEN; i++) {
      if (expectedR[i] != signature[i]) {
        return false;
      }
    }
    return true;
  }
Returns true if the EdDSA {@code signature} with {@code message}, can be verified with {@code
publicKey}.

@throws GeneralSecurityException if there is no SHA-512 algorithm defined in {@link
    EngineFactory}.MESSAGE_DIGEST.
java_src/src/main/java/com/google/crypto/tink/internal/Ed25519.java