code: func ObjectRefFromHash(h hash.Hash) *api.ObjectRef {
  	typ := reflect.TypeOf(h)
  	for algo, props := range supportedAlgos {
  		if props.typ == typ {
  			return &api.ObjectRef{
  				HashAlgo:  api.HashAlgo(algo),
  				HexDigest: HexDigest(h),
  			}
  		}
  	}
  	panic(fmt.Sprintf("unknown hash algo %T", h))
  }
docs: // ObjectRefFromHash returns ObjectRef based on the given hash.Hash.
  //
  // `h` must be one of the supported hashes (as created by `NewHash`). Panics
  // otherwise.