Пример #1
0
 def unpack(self, entry_blob, acc):
     crc_ref = super(CRC16Entry, self).unpack(entry_blob, acc)
     crc = crc16.compute(self._truncate(acc))
     if crc != crc_ref:
         raise Exception("CRC mismatch: {:X} ({:X})".format(crc, crc_ref))
     return crc_ref
Пример #2
0
 def pack(self, blob, data):
     data[self.key] = crc16.compute(self._truncate(blob))
     return super(CRC16Entry, self).pack(blob, data)