Did I find the right examples for you? yes no

All Samples(12)  |  Call(12)  |  Derive(0)  |  Import(0)
Converts a binary hash value to a base64 string, truncating to 18 bytes.

        def hash_to_str(hash_val):
    """
    Converts a binary hash value to a base64 string, truncating to 18 bytes.
    """
    assert isinstance(hash_val, buffer), "Hash values must be buffers"
    
    return base64.b64encode(hash_val[0:hash_size])
        


src/g/r/GridBackup-HEAD/grid_backup/readcap.py   GridBackup(Download)
        vals = [ buffer(hash_val), offset, compressed, delta_cnt, read_cap ]
 
        self._log.debug("Adding read cap: %s %s", util.hash_to_str(hash_val),
                        read_cap)
        self._curs.execute(sql, vals)
        vals = [ buffer(hash_val), delta_cnt, compressed, buffer(data) ]
 
        self._log.debug("Adding data cap: %s %s", util.hash_to_str(hash_val),
                        repr(str(data)))
        self._curs.execute(sql, vals)
        else:
            self._log.log(1, "Searching DB for hash %s", 
                          util.hash_to_str(hash_val))
 
        result_list = []
        else:
            self._log.log(1, "Searching logs for hash %s", 
                          util.hash_to_str(hash_val))
 
        result_list = []
    def __str__(self):
        if self.read_cap:
            val = (util.hash_to_str(self.hash_val) + 
                   " " + self.read_cap + " offset " + str(self.offset))
        elif self.data:

src/g/r/GridBackup-HEAD/grid_backup/diff_manager.py   GridBackup(Download)
            hash_value = buffer(SHA256(hash_value).digest())
 
            self.log.log(1, "Computed hash %s", util.hash_to_str(hash_value))
 
            if tmp_name:

src/g/r/GridBackup-HEAD/grid_backup/backup_series.py   GridBackup(Download)
                    self._log.debug(_("Content change (%s): %s"), 
                                   changetype, path)
                    meta['hash'] = util.hash_to_str(hash_val)
                    self._add_job(path_obj, meta, jobs)
                else:

src/g/r/GridBackup-HEAD/grid_backup/file_dict.py   GridBackup(Download)
        is where it should be.
        """
        hash_str = util.hash_to_str(hash_val)
        safe_str = hash_str.replace('/', '-')
        filename = safe_str[2:] + '.' + file_type

src/g/r/GridBackup-HEAD/grid_backup/changes.py   GridBackup(Download)
 
        hash_val = diff_mgr.hash(path)
        if old_meta and old_meta.get('hash') == util.hash_to_str(hash_val):
            # Content didn't actually change.
            log.debug("Hash indicates %s content didn't change", path_str)

src/g/r/GridBackup-HEAD/grid_backup/upload_manager.py   GridBackup(Download)
        for info in entry.info_list:
            self._log.log(1, "==== Dequeueing failed hash %s",
                          util.hash_to_str(info.hash_val))
            self._queued_hashes.remove(info.hash_val)
 

src/g/r/GridBackup-HEAD/grid_backup/tests/test_diff_manager.py   GridBackup(Download)
        # Convert h1 to string and back.  The old hash will normally be
        # retrieved from a JSON-encoded metadata dict.
        h1_str = util.hash_to_str(h1)
        h1 = util.str_to_hash(h1_str)