LoRaWAN: reversing DevEUI checksum
In a LoRaWAN network, each device is identified by an 8-byte unique identifier (DevEUI). Some manufacturers add an extra checksum byte to the DevEUI — the simplified (educational) version here is as follows:
checksum = ROL8(D0, 0) XOR ROL8(D1, 1) XOR ... XOR ROL8(D7, 7)
That is, each byte is rotated left by the amount of its position (index) (8-bit ROL), then all are XORed together. Unlike the RFID/BCC challenge in the hw category, there is also rotation here — therefore, ROR must be used when performing the reverse operation.
The attached deveui_records.txt file contains multiple DevEUI records — in each, one byte is hidden (??), but the checksum and the position of the hidden byte are known. For each record, find the hidden byte, read it as an ASCII character, and combine them in the order of the records.
If the hidden byte position is p: D_p = ROR8(checksum XOR (boshqa 7 ta ma'lum had), p mod 8) — because ROL8 and ROR8 are the inverses of each other.