def test_lrc(self): test_data = 'this is a test' assert lrc(test_data) == py_lrc(test_data)
def set_checksum(self, payload): self._checksum = lrc(repr(self), lrc(payload)) self._repr = None
def valid(self): return lrc(self.data) == 0
def verify_checksum(self): checksum = lrc(self.__header, lrc(self.__data)) self.__isValid = checksum == 0
def calculate_checksum(self): checksum = lrc(self.__header[:OFFSET_P_CHECKSUM_LOW]) checksum = lrc(self.__header[OFFSET_P_CHECKSUM_HIGH:], checksum) checksum = lrc(self.__data, checksum) return checksum