Thank you. If I’ve understood correctly then, here’s some [bad] python code that should convert key to raw if anyone searching finds this topic and needs it:
Why is ‘Bit’ set at 133 in the example at the top when it’s 136 bits?
#!/usr/bin/python3
#Vars
data_key = "00 00 1D DD 11 11 DD DD 11 DD DD DD DD DD D1 D1 11"
te = 380
#convert data key to one long binary string
binary_output = ""
for b in data_key.split(" "):
bits = bin(int(b, base=16)).split("b")[1]
padlen = 8 - len(bits)
binary_output += ("0"*padlen) + bits
#binary_output contains the binary string
#now create blocks of 1s and 0s
last_char = None
this_block = ""
this_cnt = 0
binary_blocks = []
for char in binary_output:
if last_char is None:
last_char = char
if char == last_char:
this_block += char
else:
binary_blocks.append(this_block)
this_block = char
last_char = char
binary_blocks.append(this_block)
#Now, test if the first block is zero, if so iterate backwards from the
#end of the array until we get to a 1
start_pos = 0
end_pos = len(binary_blocks) - 1
if binary_blocks[0].find('0') != -1:
start_pos = end_pos
while binary_blocks[start_pos].find('1') == -1 and start_pos != 0:
start_pos -= 1
if start_pos == 0:
print ("Error!")
quit()
#Now lets create a new set of binary_blocks starting from `start_pos' which
#is the the last block of 1s in the sequence
new_binary_blocks = []
for n in range(start_pos, end_pos+1):
new_binary_blocks.append(binary_blocks[n])
for n in range(0, start_pos):
new_binary_blocks.append(binary_blocks[n])
#Lastly, print them out as RAW
raw = ""
for b in new_binary_blocks:
if b.find('0') != -1: #It's a 0
raw += "-"
raw += str(len(b) * te) + " "
print(raw)