Checksum is initially 0. * For each data byte, XOR with the current checksum. * Rotate checksum left, carrying bit 7 to bit 0. */
| 56 | * Rotate checksum left, carrying bit 7 to bit 0. |
| 57 | */ |
| 58 | uint8_t northstarChecksum(const Bytes& bytes) |
| 59 | { |
| 60 | ByteReader br(bytes); |
| 61 | uint8_t checksum = 0; |
| 62 | |
| 63 | while (!br.eof()) |
| 64 | { |
| 65 | checksum ^= br.read_8(); |
| 66 | checksum = ((checksum << 1) | ((checksum >> 7))); |
| 67 | } |
| 68 | |
| 69 | return checksum; |
| 70 | } |
| 71 | |
| 72 | class NorthstarDecoder : public Decoder |
| 73 | { |
no test coverage detected