code: func ComputeV2MetadataHMACKey(authConfig *types.AuthConfig) ([]byte, error) {
  	if authConfig == nil {
  		return nil, nil
  	}
  	key := authConfigKeyInput{
  		Username:      authConfig.Username,
  		Password:      authConfig.Password,
  		Auth:          authConfig.Auth,
  		IdentityToken: authConfig.IdentityToken,
  		RegistryToken: authConfig.RegistryToken,
  	}
  	buf, err := json.Marshal(&key)
  	if err != nil {
  		return nil, err
  	}
  	return []byte(digest.FromBytes(buf)), nil
  }
docs: // ComputeV2MetadataHMACKey returns a key for the given "authConfig" that can be used to hash v2 metadata
  // entries.