'Sanity check the length and checksum of the pack index and data.'

def check_length_and_checksum(self):

    assert (len(self.index) == len(self.data))
    idx_stored_checksum = self.index.get_pack_checksum()
    data_stored_checksum = self.data.get_stored_checksum()
    if (idx_stored_checksum != data_stored_checksum):
        raise ChecksumMismatch(sha_to_hex(idx_stored_checksum), sha_to_hex(data_stored_checksum))
