def _md5_validation(self) -> bool:
        '''
        Verifies the MD5 checksum.
        Only used in the __init__() function
        '''
        fn = self.file if self.compressed_file is None else self.compressed_file

        md5 = hashlib.md5()
        block_size = 16384
        with fn.open('rb') as f:
            f.seek(-16, 2)
            remaining = f.tell()  # File size minus checksum size
            f.seek(0)
            while (remaining > block_size):
                data = f.read(block_size)
                remaining = remaining - block_size
                md5.update(data)

            if (remaining > 0):
                data = f.read(remaining)
                md5.update(data)

            existing_md5 = f.read(16).hex()

        return md5.hexdigest() == existing_md5
def _md5_validation ( self ) -> bool : fn = self . file if self . compressed_file is None else self . compressed_file md5 = hashlib . md5 ( ) block_size = 16384 with fn . open ( 'rb' ) as f : f . seek ( - 16 , 2 ) remaining = f . tell ( ) f . seek ( 0 ) while ( remaining > block_size ) : data = f . read ( block_size ) remaining = remaining - block_size md5 . update ( data ) if ( remaining > 0 ) : data = f . read ( remaining ) md5 . update ( data ) existing_md5 = f . read ( 16 ) . hex ( ) return md5 . hexdigest ( ) == existing_md5
Verifies the MD5 checksum.
        Only used in the __init__() function