Python hashlib._Hash() Examples

The following are 21 code examples of hashlib._Hash(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module hashlib , or try the search function .
Example #1
Source File: image_builder.py    From scalyr-agent-2 with Apache License 2.0 5 votes vote down vote up
def get_checksum(cls, hash_object=None):
        # type: (Optional[hashlib._Hash]) -> hashlib._Hash
        """
        Get sha265 checksum of the dockerfile and included files.
        Also, include checksums of all required builders.
        """

        if hash_object is None:
            hash_object = hashlib.sha256()

        for builder_cls in cls.REQUIRED_CHECKSUM_IMAGES:
            hash_object = builder_cls.get_checksum(hash_object=hash_object)

        if cls.IGNORE_CACHING:
            return hash_object

        dockerfile = cls.get_dockerfile_content()
        hash_object.update(dockerfile.encode("utf-8"))

        for path in cls.INCLUDE_PATHS:
            if path.is_dir():
                # TODO implement checksum calculation for directories.
                pass
            else:
                hash_object.update(path.read_bytes())

        return hash_object 
Example #2
Source File: hashes.py    From V1EngineeringInc-Docs with Creative Commons Attribution Share Alike 4.0 International 5 votes vote down vote up
def _raise(self, gots):
        # type: (Dict[str, _Hash]) -> NoReturn
        raise HashMissing(gots[FAVORITE_HASH].hexdigest()) 
Example #3
Source File: hashes.py    From V1EngineeringInc-Docs with Creative Commons Attribution Share Alike 4.0 International 5 votes vote down vote up
def _raise(self, gots):
        # type: (Dict[str, _Hash]) -> NoReturn
        raise HashMismatch(self._allowed, gots) 
Example #4
Source File: hashes.py    From Carnets with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def _raise(self, gots):
        # type: (Dict[str, _Hash]) -> NoReturn
        raise HashMissing(gots[FAVORITE_HASH].hexdigest()) 
Example #5
Source File: hashes.py    From Carnets with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def _raise(self, gots):
        # type: (Dict[str, _Hash]) -> NoReturn
        raise HashMismatch(self._allowed, gots) 
Example #6
Source File: hashes.py    From CogAlg with MIT License 5 votes vote down vote up
def _raise(self, gots):
        # type: (Dict[str, _Hash]) -> NoReturn
        raise HashMissing(gots[FAVORITE_HASH].hexdigest()) 
Example #7
Source File: hashes.py    From CogAlg with MIT License 5 votes vote down vote up
def _raise(self, gots):
        # type: (Dict[str, _Hash]) -> NoReturn
        raise HashMismatch(self._allowed, gots) 
Example #8
Source File: hashes.py    From coffeegrindsize with MIT License 5 votes vote down vote up
def _raise(self, gots):
        # type: (Dict[str, _Hash]) -> NoReturn
        raise HashMissing(gots[FAVORITE_HASH].hexdigest()) 
Example #9
Source File: hashes.py    From coffeegrindsize with MIT License 5 votes vote down vote up
def _raise(self, gots):
        # type: (Dict[str, _Hash]) -> NoReturn
        raise HashMismatch(self._allowed, gots) 
Example #10
Source File: hashes.py    From rules_pip with MIT License 5 votes vote down vote up
def _raise(self, gots):
        # type: (Dict[str, _Hash]) -> NoReturn
        raise HashMissing(gots[FAVORITE_HASH].hexdigest()) 
Example #11
Source File: hashes.py    From rules_pip with MIT License 5 votes vote down vote up
def _raise(self, gots):
        # type: (Dict[str, _Hash]) -> NoReturn
        raise HashMismatch(self._allowed, gots) 
Example #12
Source File: hashes.py    From Mastering-Elasticsearch-7.0 with MIT License 5 votes vote down vote up
def _raise(self, gots):
        # type: (Dict[str, _Hash]) -> NoReturn
        raise HashMismatch(self._allowed, gots) 
Example #13
Source File: hashes.py    From scylla with Apache License 2.0 5 votes vote down vote up
def _raise(self, gots):
        # type: (Dict[str, _Hash]) -> NoReturn
        raise HashMissing(gots[FAVORITE_HASH].hexdigest()) 
Example #14
Source File: hashes.py    From scylla with Apache License 2.0 5 votes vote down vote up
def _raise(self, gots):
        # type: (Dict[str, _Hash]) -> NoReturn
        raise HashMismatch(self._allowed, gots) 
Example #15
Source File: hashes.py    From pipenv with MIT License 5 votes vote down vote up
def _raise(self, gots):
        # type: (Dict[str, _Hash]) -> NoReturn
        raise HashMissing(gots[FAVORITE_HASH].hexdigest()) 
Example #16
Source File: hashes.py    From pipenv with MIT License 5 votes vote down vote up
def _raise(self, gots):
        # type: (Dict[str, _Hash]) -> NoReturn
        raise HashMismatch(self._allowed, gots) 
Example #17
Source File: hashes.py    From pex with Apache License 2.0 5 votes vote down vote up
def _raise(self, gots):
        # type: (Dict[str, _Hash]) -> NoReturn
        raise HashMissing(gots[FAVORITE_HASH].hexdigest()) 
Example #18
Source File: hashes.py    From pex with Apache License 2.0 5 votes vote down vote up
def _raise(self, gots):
        # type: (Dict[str, _Hash]) -> NoReturn
        raise HashMismatch(self._allowed, gots) 
Example #19
Source File: hashes.py    From Mastering-Elasticsearch-7.0 with MIT License 5 votes vote down vote up
def _raise(self, gots):
        # type: (Dict[str, _Hash]) -> NoReturn
        raise HashMissing(gots[FAVORITE_HASH].hexdigest()) 
Example #20
Source File: hashes.py    From Mastering-Elasticsearch-7.0 with MIT License 5 votes vote down vote up
def _raise(self, gots):
        # type: (Dict[str, _Hash]) -> NoReturn
        raise HashMismatch(self._allowed, gots) 
Example #21
Source File: hashes.py    From Mastering-Elasticsearch-7.0 with MIT License 5 votes vote down vote up
def _raise(self, gots):
        # type: (Dict[str, _Hash]) -> NoReturn
        raise HashMissing(gots[FAVORITE_HASH].hexdigest())