public static void validateSignatureHash(HashType hash) throws GeneralSecurityException {
    switch (hash) {
      case SHA256: // fall through
      case SHA384: // fall through
      case SHA512:
        return;
      default:
        break;
    }
    throw new GeneralSecurityException("Unsupported hash: " + hash.name());
  }
Validates whether {@code hash} is safe to use for digital signature.

@throws GeneralSecurityException if {@code hash} is invalid or is not safe to use for digital
    signature.
java_src/src/main/java/com/google/crypto/tink/subtle/Validators.java