def _compute_page_erase_pages_and_weight_crc32(self, assume_estimate_correct=False):
        # Build list of all the pages that need to be analyzed
        sector_list = []
        page_list = []
        for page in self.page_list:
            if page.same is None:
                # Add sector to computeCrcs
                sector_list.append((page.addr, page.size))
                page_list.append(page)
                # Compute CRC of data (Padded with 0xFF)
                data = list(page.data)
                pad_size = page.size - len(page.data)
                if pad_size > 0:
                    data.extend([0xFF] * pad_size)
                page.crc = crc32(bytearray(data)) & 0xFFFFFFFF

        # Analyze pages
        page_erase_count = 0
        page_erase_weight = 0
        if len(page_list) > 0:
            crc_list = self.flash.computeCrcs(sector_list)
            for page, crc in zip(page_list, crc_list):
                page_same = page.crc == crc
                if assume_estimate_correct:
                    page.same = page_same
                elif page_same is False:
                    page.same = False

        # Put together page and time estimate
        for page in self.page_list:
            if page.same is False:
                page_erase_count += 1
                page_erase_weight += page.getEraseProgramWeight()
            elif page.same is None:
                # Page is probably the same but must be read to confirm
                page_erase_weight += page.getVerifyWeight()
            elif page.same is True:
                # Page is confirmed to be the same so no programming weight
                pass

        self.page_erase_count = page_erase_count
        self.page_erase_weight = page_erase_weight
        return page_erase_count, page_erase_weight
A trimmed down version of Python's HMAC implementation
dataset/ETHPy150Open mbedmicro/pyOCD/pyOCD/flash/flash_builder.py/FlashBuilder._compute_page_erase_pages_and_weight_crc32--crossover with--dataset/ETHPy150Open gratipay/gratipay.com/gratipay/security/crypto.py/_fast_hmac