Update for 15-12-21 15:00
This commit is contained in:
parent
f6c12a1e80
commit
276d18afa8
@ -22,3 +22,42 @@ A *tap* is where a bit is read and fed back into itself.
|
|||||||
An LFSR generates values based on a linear expression modulous 2, therefore we
|
An LFSR generates values based on a linear expression modulous 2, therefore we
|
||||||
can reverse engineer the state of the LFSR based on a sequence we are given.
|
can reverse engineer the state of the LFSR based on a sequence we are given.
|
||||||
This can be done using the Berlekamp-Massey algorithm.
|
This can be done using the Berlekamp-Massey algorithm.
|
||||||
|
|
||||||
|
So first we will start with a simpler version. If we have a sequence and we
|
||||||
|
know the number of bits in the LSFR, we can create a matrix of the values.
|
||||||
|
If S_{i} is the _i_ th value out of an LSFR, we can solve the following
|
||||||
|
|
||||||
|
Sa = x
|
||||||
|
|
||||||
|
Where S is a matrix of the outputted values formatted below
|
||||||
|
|
||||||
|
A has the coefficents of the LFSR
|
||||||
|
|
||||||
|
and x has values of the bit string, as formatted below.
|
||||||
|
|
||||||
|
{{{
|
||||||
|
Assume 4 bits
|
||||||
|
-- ---- -- -- --
|
||||||
|
| s0 s1 s2 s3 || a0 | | s4 |
|
||||||
|
| s1 s2 s3 s4 || a1 | = | s5 |
|
||||||
|
| s2 s3 s4 s5 || a2 | | s6 |
|
||||||
|
| s3 s4 s5 s6 || a3 | | s7 |
|
||||||
|
-- ---- -- -- --
|
||||||
|
}}}
|
||||||
|
|
||||||
|
Note that
|
||||||
|
- The S matrix is _n_ bits squared
|
||||||
|
- All other matrices are _n_ tall
|
||||||
|
- You need 2*n - 1 sample bits
|
||||||
|
|
||||||
|
Given this, we can find the coefficents by solving
|
||||||
|
|
||||||
|
a = S^-1 * x
|
||||||
|
|
||||||
|
Once we do this, it will give us all of the coefficents! Everywhere there
|
||||||
|
is a 1 a tap will be located there and all of these values are XORed and placed
|
||||||
|
onto the back of the register.
|
||||||
|
|
||||||
|
To make this the Berlekamp-Massey algorithm, we first start and assume the
|
||||||
|
number of bits _n_ is 1, check if it makes the right seuqnece, and if not we
|
||||||
|
increase _n_ and try again. That all there is to it!
|
||||||
|
Loading…
Reference in New Issue
Block a user