public static Enums.HashType toHashType(HashType hash) throws GeneralSecurityException {
    switch (hash) {
      case SHA256:
        return Enums.HashType.SHA256;
      case SHA384:
        return Enums.HashType.SHA384;
      case SHA512:
        return Enums.HashType.SHA512;
      default:
        break;
    }
    throw new GeneralSecurityException("unsupported hash type: " + hash.name());
  }
Converts protobuf enum {@code HashType} to raw Java enum {@code Enums.HashType}.

@throws GeneralSecurityException if the HashType is not SHA256, SHA384, or SHA512.
java_src/src/main/java/com/google/crypto/tink/signature/internal/SigUtil.java