How to use the b2sdk.utils.hex_sha1_of_unlimited_stream function in b2sdk

To help you get started, we’ve selected a few b2sdk examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Backblaze / b2-sdk-python / b2sdk / transfer / emerge / planner / part_definition.py View on Github external
def get_sha1(self):
        if self._sha1 is None:
            if self.relative_offset == 0 and self.length == self.upload_source.get_content_length():
                # this is part is equal to whole upload source - so we use `get_content_sha1()`
                # and if sha1 is already given, we skip computing it again
                self._sha1 = self.upload_source.get_content_sha1()
            else:
                with self._get_stream() as stream:
                    self._sha1, _ = hex_sha1_of_unlimited_stream(stream)
        return self._sha1
github Backblaze / b2-sdk-python / b2sdk / transfer / outbound / upload_source.py View on Github external
def _set_content_length_and_sha1(self):
        sha1, content_length = hex_sha1_of_unlimited_stream(self.open())
        self._content_length = content_length
        self._content_sha1 = sha1
github Backblaze / b2-sdk-python / b2sdk / transfer / emerge / planner / part_definition.py View on Github external
def get_sha1(self):
        if self._sha1 is None and self.is_hashable():
            with self._get_stream() as stream:
                self._sha1, _ = hex_sha1_of_unlimited_stream(stream)
        return self._sha1
github Backblaze / b2-sdk-python / b2sdk / transfer / emerge / planner / upload_subpart.py View on Github external
def get_subpart_id(self):
        with self._get_stream() as stream:
            sha1, _ = hex_sha1_of_unlimited_stream(stream)
            return sha1