我该如何实现这个算法?

时间:2023-01-27 11:16:20

A while back I was trying to bruteforce a remote control which sent a 12 bit binary 'key'.

不久前,我试图强行发送一个12位二进制“密钥”的遥控器。

The device I made worked, but was very slow as it was trying every combination at about 50 bits per second (4096 codes = 49152 bits = ~16 minutes)

我制作的设备工作,但速度非常慢,因为它以每秒约50位的速度尝试每个组合(4096个代码= 49152位= ~16分钟)

I opened the receiver and found it was using a shift register to check the codes and no delay was required between attempts. This meant that the receiver was simply looking at the last 12 bits to be received to see if they were a match to the key.

我打开接收器,发现它使用移位寄存器检查代码,尝试之间不需要延迟。这意味着接收器只是查看要接收的最后12位,看它们是否与密钥匹配。

This meant that if the stream 111111111111000000000000 was sent through, it had effectively tried all of these codes.

这意味着如果通过流111111111111000000000000发送,它已经有效地尝试了所有这些代码。

111111111111    111111111110    111111111100    111111111000
111111110000    111111100000    111111000000    111110000000
111100000000    111000000000    110000000000    100000000000
000000000000

In this case, I have used 24 bits to try 13 12 bit combinations (>90% compression).

在这种情况下,我使用了24位来尝试13个12位组合(> 90%压缩)。

Does anyone know of an algorithm that could reduce my 49152 bits sent by taking advantage of this?

有没有人知道一种算法可以通过利用这个来减少我发送的49152位?

2 个解决方案

#1


What you're talking about is a de Bruijn sequence. If you don't care about how it works, you just want the result, here it is.

你所说的是de Bruijn序列。如果你不关心它是如何工作的,你只需要结果,就在这里。

#2


Off the top of my head, I suppose flipping one bit in each 12-bit sequence would take care of another 13 combinations, for example 111111111101000000000010, then 111111111011000000000100, etc. But you still have to do a lot permutations, even with one bit I think you still have to do 111111111101000000000100 etc. Then flip two bits on one side and 1 on the other, etc.

在我的脑海中,我想在每个12位序列中翻转一位会处理另外13个组合,例如111111111101000000000010,然后是111111111011000000000100等。但是你仍需要做很多排列,即使只有一点我认为你还是要做111111111101000000000100等。然后在一侧翻转两位,在另一侧翻转1,等等。

#1


What you're talking about is a de Bruijn sequence. If you don't care about how it works, you just want the result, here it is.

你所说的是de Bruijn序列。如果你不关心它是如何工作的,你只需要结果,就在这里。

#2


Off the top of my head, I suppose flipping one bit in each 12-bit sequence would take care of another 13 combinations, for example 111111111101000000000010, then 111111111011000000000100, etc. But you still have to do a lot permutations, even with one bit I think you still have to do 111111111101000000000100 etc. Then flip two bits on one side and 1 on the other, etc.

在我的脑海中,我想在每个12位序列中翻转一位会处理另外13个组合,例如111111111101000000000010,然后是111111111011000000000100等。但是你仍需要做很多排列,即使只有一点我认为你还是要做111111111101000000000100等。然后在一侧翻转两位,在另一侧翻转1,等等。