This commit is contained in:
awe
2026-02-18 18:41:19 +03:00
parent 662a42776f
commit 71e5eb9ecb
2 changed files with 4 additions and 4 deletions

View File

@ -404,12 +404,12 @@ class Protocol:
def get_int_word(num: int) -> int:
return int(get_word(num), 16)
# CRC check: XOR over words 1..13, compare with word 14
# CRC check: XOR over words 1..13 (wire order), compare with word 14 (wire order)
crc_words = [hex_str[i:i+4] for i in range(4, len(hex_str)-4, 4)]
computed = int(crc_words[0], 16)
for w in crc_words[1:]:
computed ^= int(w, 16)
stored = get_int_word(14)
stored = int(hex_str[56:60], 16)
if computed != stored:
raise CRCError(expected=computed, received=stored)