Skip to content

Commit

Permalink
init README
Browse files Browse the repository at this point in the history
  • Loading branch information
JuliaPoo committed Mar 4, 2020
1 parent 99fccee commit 69c64df
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Model E1337 - Rolling Code Lock/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ Predicting the output of ```next(26)``` is equivalent to predicting the output o

My approach to predict the ```getrandbit``` is to use the output of a few ```next(26)``` to recover as much of ```state``` as needed to be able to predict the next bits. An observation is that the output of ```getrandbit``` is can be represented as a series of XOR of the bits of the original state (from ```setup(seed)```).

Define the original state as a list of sets. ```state_a = [{63}, {62}, {61}, {60}...{0}]```. The numbers represent the index of the bit of the state, ```63``` being the ```MSB``` and ```0``` being the ```LSB```. As ```state_a``` gets put through ```getrandbit```, it will evolve. E.g. ```state_a = [{0}, {63, 61}...]```. The nth set in ```state_a``` represents the nth bit of ```state_a``` as a sequence of XORs of the bits of the original state. E.g. if ```state_a[2] = {63, 61}```, then ```state & 2**2 = a63 ^ a61```, where the original state has bits ```a63, a62, a61..., a0```.
Define the original state as a list of sets. ```state_a = [{63}, {62}, {61}, {60}...{0}]```. The numbers represent the index of the bit of the state, ```63``` being the ```MSB``` and ```0``` being the ```LSB```. As ```state_a``` gets put through ```getrandbit```, it will evolve. E.g. ```state_a = [{0}, {63, 61}...]```. The nth set in ```state_a``` represents the nth bit of ```state_a``` as a sequence of XORs of the bits of the original state. E.g. if ```state_a[-5] = {63, 61}```, then ```state & 2**4 = a63 ^ a61```, where the original state has bits ```a63, a62, a61..., a0```.

A function ```getrandbit_track(state_a)``` would evolve ```state_a``` upon passing through ```getrandbit```. My implementation as follows. Do note that I reserved index ```64``` to represent ```1```, while all the other index represents the nth bit of the original state:

Expand Down

0 comments on commit 69c64df

Please sign in to comment.