Closed merbanan closed 4 years ago
Very nice! Perhaps the shift
arg should be a bit-field, flagging which of the 8 possible shift-xor should be applied. (0x30 would be the example one: shift by 4 and 5). Currently it's a fixed shift-4 and one additional shift. Also the 0x0F
mask isn't needed, the shift already clears the lower bits.
Even better: if we expand the search space to 16 bit, 8-bit field for shift-ups, 8-bit field for shift-downs, we'd also cover rolls. E.g. 0x08, 0x08, would shift up and down by 4, effectively roll by 4.
Yes that sounds reasonable. We should add all the used checksums from rtl_433 decoders. I also worked on a program that would find bit differing codes to generate the kind of map discussed in the Insteon thread. Then I realized it would be nice with a code filtering/analyzer tool also. We'll see how far I get.
We could add + as operator also instead of ^.
If you sum with carry you would traditionally use coprimes as factors, not multiples of 2. E.g. ISBN does something like this (not coprimes though).
I've update the xor_shift_bytes for all possible shift ups and downs with bb9db51. Search space is only 16k params. On the Insteon data it should show
Found: xor_shift_bytes(&b[0], 9, 0x18, 0x00) ^ b[9] == 0; // (100.0%)
Where
0x18, 0x00 =
00011000 00000000
^- shift up by 4
^- shift up by 5
Works with the Insteon payload and maybe others.