code: func (bw *blobWriter) resumeDigest(ctx context.Context) error {
  	if !bw.resumableDigestEnabled {
  		return errResumableDigestNotAvailable
  	}
  
  	h, ok := bw.digester.Hash().(encoding.BinaryUnmarshaler)
  	if !ok {
  		return errResumableDigestNotAvailable
  	}
  
  	offset := bw.fileWriter.Size()
  	if offset == bw.written {
  		// State of digester is already at the requested offset.
  		return nil
  	}
  
  	// List hash states from storage backend.
  	var hashStateMatch hashStateEntry
  	hashStates, err := bw.getStoredHashStates(ctx)
  	if err != nil {
  		return fmt.Errorf("unable to get stored hash states with offset %d: %s", offset, err)
  	}
  
  	// Find the highest stored hashState with offset equal to
  	// the requested offset.
  	for _, hashState := range hashStates {
  		if hashState.offset == offset {
  			hashStateMatch = hashState
  			break // Found an exact offset match.
  		}
  	}
  
  	if hashStateMatch.offset == 0 {
  		// No need to load any state, just reset the hasher.
  		h.(hash.Hash).Reset()
  	} else {
  		storedState, err := bw.driver.GetContent(ctx, hashStateMatch.path)
  		if err != nil {
  			return err
  		}
  
  		if err = h.UnmarshalBinary(storedState); err != nil {
  			return err
  		}
  		bw.written = hashStateMatch.offset
  	}
  
  	// Mind the gap.
  	if gapLen := offset - bw.written; gapLen > 0 {
  		return errResumableDigestNotAvailable
  	}
  
  	return nil
  }
docs: // resumeDigest attempts to restore the state of the internal hash function
  // by loading the most recent saved hash state equal to the current size of the blob.