liveBook · Manning

Weighted sum

As explained in Hacking Cryptography

A linear combination is an expression formed by multiplying values by coefficients and adding the resulting terms.

A weighted sum multiplies values by coefficients and adds the resulting terms. In Boolean LFSRs, multiplication becomes AND and addition becomes XOR, producing each new state bit from tapped prior bits. section 4.2.2

Equation 4.4
\[s_{n+1} = a_{0}s_{n-L} + ... + a_{L-1}s_{n-1} + a_{L}s_{n} \label{equation:lfsr}\]

The LFSR recurrence writes the next bit as a weighted sum of earlier sequence values and tap coefficients. section 4.2.2

A weighted sum supports LFSR tap recovery through these operations:

  • Arrange observed sequence bits into a state matrix S and collect subsequent bits in X. section 4.2.2
  • Model the recurrence as X = SA, where A contains the unknown tap coefficients. section 4.2.2
  • Recover the taps with A = S⁻¹X when S is invertible; Boolean matrix operations use XOR and AND. section 4.2.2

Recovering an LFSR from known plaintext

A known prefix reveals keystream bits by XORing plaintext with ciphertext. The recovery code tests candidate LFSR lengths, clones a valid recurrence, and decrypts the remaining ciphertext; the test obtains the original timestamped message.

How Hacking Cryptography covers it

How deep it goes
Explains recurrence equations, matrix inversion, Boolean arithmetic, and executable recovery code, stopping at LFSR exploitation.
Examples
Demonstrates three-bit LFSR recurrences, matrix equations, Go recovery functions, and timestamped known-plaintext decryption.
What it assumes
Assumes basic matrix operations and Boolean logic while explaining the LFSR recurrence and its algebraic translation.
What you can do after
Diagnose weak LFSR constructions and recover their taps from sufficient observed or known-plaintext-derived bits.
How it connects
Connects weighted sums to LFSRs, linear algebra, matrix inversion, XOR, AND, and known-plaintext attacks.

Also explained in

Compare how 4 books explain weighted sum →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Hacking Cryptography. The section links point to the parts of the book it draws on.