private static HashType toProtoHashType(HmacPrfParameters.HashType hashType)
      throws GeneralSecurityException {
    if (HmacPrfParameters.HashType.SHA1.equals(hashType)) {
      return HashType.SHA1;
    }
    if (HmacPrfParameters.HashType.SHA224.equals(hashType)) {
      return HashType.SHA224;
    }
    if (HmacPrfParameters.HashType.SHA256.equals(hashType)) {
      return HashType.SHA256;
    }
    if (HmacPrfParameters.HashType.SHA384.equals(hashType)) {
      return HashType.SHA384;
    }
    if (HmacPrfParameters.HashType.SHA512.equals(hashType)) {
      return HashType.SHA512;
    }
    throw new GeneralSecurityException("Unable to serialize HashType " + hashType);
  }
Methods to serialize and parse {@link HmacPrfKey} objects and {@link HmacPrfParameters} objects.
java_src/src/main/java/com/google/crypto/tink/prf/internal/HmacPrfProtoSerialization.java