Exemplo n.º 1
0
    def crc16_checksum(self):
        """Get CRC16 checksum
        
        A cyclic redundancy check (CRC) is an error-detecting code commonly 
        used in digital networks and storage devices to detect accidental changes 
        to raw data. The CRC was invented by W. Wesley Peterson in 1961.

        Returns:
            Chepy: The Chepy object. 
        """
        self.state = CrcArc().process(self._convert_to_bytes()).finalhex()
        return self
Exemplo n.º 2
0
def makepkg(values):
    packet = []

    packet.append(len(values) + 3)

    packet += values

    p = CrcArc()
    p.process(packet)
    crc = p.final()

    packet.append(crc >> 8 & 0xFF)
    packet.append(crc & 0xFF)

    return packet