code: def hash_bytes(buf):
      
      sha256 = hashlib.sha256()
      sha256.update(buf)
      return 'sha256:' + sha256.hexdigest()
docs: Hash bytes using the same method the registry uses (currently SHA-256).
  
      :param buf: Bytes to hash
      :type buf: binary str
  
      :rtype: str
      :returns: Hex-encoded hash of file's content (prefixed by ``sha256:``)