Exemple #1
0
 def save_payload(self, output_stream):
     self.payload_stream = self.input_stream
     c_hash = checksum.getHashlibInstance(self.header.checksum_type(), False)
     self._encode_payload(output_stream, c_hash)
     self.checksum = c_hash.hexdigest()
     if output_stream:
         self.payload_stream = output_stream
Exemple #2
0
 def save_payload(self, output_stream):
     c_hash = checksum.getHashlibInstance(self.checksum_type, False)
     if output_stream:
         output_start = output_stream.tell()
     self._stream_copy(self.header_data, output_stream, c_hash)
     self.checksum = c_hash.hexdigest()
     if output_stream:
         self.payload_stream = output_stream
         self.payload_size = output_stream.tell() - output_start
Exemple #3
0
    def __get_file_checksum(self, xml_file):
        hash_computer = checksum.getHashlibInstance(self.__get_checksumtype(),
                                                    False)

        chunk = xml_file.read(CHUNK_SIZE)
        while chunk:
            hash_computer.update(chunk)
            chunk = xml_file.read(CHUNK_SIZE)

        return hash_computer.hexdigest()