Skip to main content
IoT
PSUT Engineering StudioPrincess Sumaya University for Technology
V21.6.5 · Student / connected
Cyber Defense StudioIoT Security and PrivacyExperimentsWorkspaces
Continue to CR33 — full RC4 KSA and PRGA →

V22.7 · Interactive algorithms, Python notebooks and WSL resources

Home / IoT Security and Privacy / EC05
IoTPSUT IoT Engineering StudioPrincess Sumaya University for Technology · Dr. Mohammad Alja’afreh
ESSENTIAL LABORATORY · EC05 · IoT SECURITY AND PRIVACY
IoT Security and Privacy

Stream ciphers — Polynomials and LFSRs

Analyze polynomial roots, divisibility and irreducibility, then trace the state and period of a linear-feedback shift register.

Design experiment & verify evidence →
EC05 · Laboratory mentorAsk about the current experiment, its algorithms or Python notebook.
Ask Dr. MohammadAdaptive practice
EC05 · Academic orientation

Scope and objectives

Scope of the experiment

Analyze polynomial roots, divisibility and irreducibility, then trace the state and period of a linear-feedback shift register.

The focus of this experiment is to represent binary polynomials and trace LFSR feedback taps. Students then calculate shift-register state, output bits and period, and explain why linear sequences alone are unsuitable cryptographic keystreams. The Concepts view explains the operation before the practical work; the Simulation view is used to examine reference and changed inputs, not to substitute for actual measurements.

Learning objectives

  • Represent binary polynomials and trace LFSR feedback taps.
  • Calculate shift-register state, output bits and period.
  • Explain why linear sequences alone are unsuitable cryptographic keystreams.
  • Record the relevant inputs, intermediate states and final verification result before changing the reference configuration.
  • Compare the reference calculation or decision with an independent implementation or authorized observation; state any discrepancy and the applicable model boundary.

Expected learning outcomes

On completion, students can represent binary polynomials and trace LFSR feedback taps, calculate shift-register state, output bits and period, and explain why linear sequences alone are unsuitable cryptographic keystreams.

Required deliverables

Submit the derivation or state trace for the named operation, the exact reference and changed configurations, the associated simulator or practical evidence, and a short validation statement addressing explain why linear sequences alone are unsuitable cryptographic keystreams. Separate predicted values from observations.

Prerequisite knowledge and related learning

Review the foundational terminology in Concepts and confirm readiness using the existing setup instructions. After completion, continue to Modular arithmetic in Python — Reusable crypto functions.

Environment and experimental methodology

The included teaching workstation and the listed Python/Colab or WSL implementation. Historical and small-number constructions are instructional, not deployment recommendations.

Begin with a manual prediction, record the baseline, change one independent condition at a time, and compare the resulting trace or measurements with the original prediction. Record observations and uncertainty separately from reference values. Follow the experiment’s specific procedure, safety limits, and acceptance checks.

How to investigate Stream ciphers — Polynomials and LFSRs

Analyze polynomial roots, divisibility and irreducibility, then trace the state and period of a linear-feedback shift register.

Analytical investigation means collecting an observation, identifying the mechanism, using a calculation or state trace to explain it, and checking your conclusion against evidence. Controlled comparison means changing one independent variable, holding the remaining relevant conditions constant, and measuring a dependent variable against a baseline. Experimental validation means comparing a predicted result to a reproducible observation or assertion; agreement inside a model does not certify hardware. Evidence-based reasoning connects a specific observation to a theoretical rule and states uncertainty, not merely an opinion. Performance characterization records a named metric and its units across conditions; sensitivity analysis changes one parameter across several values. A threat assessment links an asset, threat, consequence and evidence to a mitigation.

Experiment-specific guided practice

Objective: Analyze polynomial roots, divisibility and irreducibility, then trace the state and period of a linear-feedback shift register.

  1. Complete the analytical preparation below before programming. Show the intermediate mathematical calculations.
  2. Polynomial roots and divisibility over reals — complete its numbered steps and record the requested evidence.
  3. Polynomials over GF(2) — complete its numbered steps and record the requested evidence.
  4. Three assigned LFSR traces — complete its numbered steps and record the requested evidence.

Reference check: The primitive 4-bit example yields period 15 for nonzero state; the zero state is absorbing. \(x^{2}\)+x+1 divides \(x^{4}\)+\(x^{2}\)+1.

Model boundary: Fictional educational inputs. Browser algorithms and reference programs; no hardware or live-network measurements. Supplied starter notebooks may be incomplete; trace playback is recorded execution, not arbitrary Python running in browser.

Independent task and submission evidence

2. Polynomial roots and divisibility over reals — complete its numbered steps and record the requested evidence. Record the named input, prediction, actual output and one limitation; restore the original condition and repeat.

Before execution write the independent variable and its levels, dependent observation with units where applicable, baseline, controlled variables, measurement method and expected result. For a state machine use state/event/output rather than inventing a numeric metric. Record failures and repeat the baseline. A weak conclusion is “it works”; a supported conclusion names the changed setting, observed value/state, corresponding rule and one limitation.

TrialChanged settingFixed settingsPredicted resultActual observation / unitsEvidence / uncertainty
A: baselineReferenceRecordPredictRecordRecord
B: one changeRecordSame as APredictRecordRecord
A: repeatRestoreSame as APredictRecordRecord

Completion: submit the filled table, relevant simulator screenshot or terminal/notebook output, reasoning with units/assumptions, and one limitation. Preserve the independent assessment questions; this guide does not fill their answers.

Scientific concepts and engineering principles

Scientific architecture · EC05 · Stream ciphers — Polynomials and LFSRs

LFSR shift and feedback — Register / 4-bit nonzero seed; Feedback / selected taps XOR; Shift / next register state; Output / one designated bit; Period / repeat initial state (≤15)
Scientific concept map: Binary seed — Register bits; Feedback polynomial — XOR taps; Shift register — Clock transition; Output bit — Keystream; Period — State recurrence.

Polynomial arithmetic

Over the real numbers, a root a of P implies that X−a divides P. Over GF(2), coefficients are 0 or 1 and addition is XOR. Multiply polynomials by collecting coefficients modulo 2; division cancels the leading term until the remainder has smaller degree than the divisor.

Irreducibility and primitive feedback

A polynomial with a root and degree greater than one is reducible. A polynomial of degree four can have no linear root yet factor into quadratics. A primitive degree-n feedback polynomial produces a maximal-length nonzero LFSR cycle under the corresponding convention; irreducibility alone is insufficient.

Register evolution

A clock shifts the register and feeds back the XOR of selected taps. Record the complete state, output bit and first repeated state. Compare actual cycle length with 2^n−1 and identify transient states; the all-zero state is a fixed point for a linear recurrence.

Prerequisites: EC04 and earlier foundations as applicable.

EC05 engineering diagram
Algorithm structure and data flow. Use the simulation to inspect the corresponding numerical transformations.

Engineering diagrams

Register feedback produces a deterministic bit sequence.
Register feedback produces a deterministic bit sequence.

Scientific foundations and worked examples

Roots, divisibility and polynomial division

Over the reals, \(X^{2}\)−3X+2=(X−1)(X−2), whereas \(X^{2}\)−X−1 has roots (1±√5)/2. Over a field, P(a)=0 if and only if X−a divides P. Divisibility allows a constant quotient. Long division repeatedly cancels the leading term; in GF(2), subtraction equals addition, so the cancellation is XOR. (X+2)(X+3) becomes \(X^{2}\)+X in GF(2).

Irreducibility versus primitivity

A polynomial of degree at least two with a root in its coefficient field is reducible. The converse is false for degree four and above: \(X^{4}\)+\(X^{2}\)+1=(\(X^{2}\)+X+1)² over GF(2), though it has no binary root. For degrees two and three, absence of roots is sufficient. A primitive degree-n polynomial is irreducible and its root generates the nonzero elements of \(\mathrm{GF}(2^{n})\); irreducibility alone does not guarantee a maximal LFSR period.

Register timing and cycle measurement

For right-shifting registers [\(s_{2}\),\(s_{1}\),\(s_{0}\)] with feedback \(s_{1}\) XOR \(s_{0}\) (\(X^{3}\)+X+1), seed 100 evolves as 100→010→101→110→111→011→001→100. The period is 7. A primitive feedback polynomial gives \(2^{n}\)−1 for a nonzero seed under the matching convention. Record output bit, feedback bit and next register at each clock; stop on the first repeated state. If a transient leads into a cycle, period counts only the repeated cycle, not the transient. Linear feedback alone is predictable and is not a modern secure keystream generator.

Engineering principles · additional worked teaching example

An LFSR updates a finite binary state by XOR feedback and shifting. For a stated three-bit recurrence (a,b,c)→(b,c,a XOR c), state (1,0,0) becomes (0,0,1), then (0,1,1). All-zero stays zero. A maximal period does not imply unpredictability.

From theory to experiment

Predict the reference result before operating the workbench; check the actual intermediate state, units and constraints. The existing simulation, implementation and procedure below are distinct sources of evidence.

Worked engineering reasoning and boundary conditions

An LFSR shifts a bit register and inserts feedback formed by XOR of selected taps. For an n-bit nonzero-state maximal LFSR the upper period is 2^n−1. A linear recurrence is not a modern secure keystream.

Use the diagram to follow the calculation or state progression. Keep the teaching configuration separate from the independent exercise values; compare observations with the actual model and implementation.

Concept animation · operation pathway

Explore the teaching example independently of the simulator. Each step reveals an operation, data relationship or calculated state. The Simulation view has separate editable inputs.

Stream ciphers — Polynomials and LFSRs: operation pathwayRegister1 0 1 1Feedbacks0 XOR s3=0Output1; shift rightNew register0 1 0 1Read the active operation, then inspect the accumulated state.

Step 1 of 4 · Register

Register

Register
1 0 1 1

Teaching example only; inspect live calculations or real practical evidence separately.

Interactive flashcards

Self-rated study progress is stored locally, not used for official grades.

Browse all explanations
What is LFSR feedback?

XOR of selected register bits.

Why avoid all-zero seed?

A linear register remains zero.

Does irreducible imply primitive?

No; maximum period requires primitive feedback.

What is binary polynomial addition?

Coefficient-wise XOR.

What are the elements of GF(2)?

0 and 1.

What is addition in GF(2)?

XOR.

What does polynomial reduction mean?

Take the remainder after division by the modulus polynomial.

What is an irreducible polynomial?

A nonconstant polynomial with no nontrivial factors over the field.

Is every irreducible polynomial primitive?

No. Primitive is a stronger property.

Why is an all-zero LFSR seed unsuitable?

It is an absorbing state under linear feedback.

What is the maximum period of an n-stage binary LFSR?

2^n−1 for a primitive feedback polynomial and nonzero seed.

What does a tap define?

A register bit participating in feedback.

How do you measure period experimentally?

Clock until the entire initial register state repeats.

Why distinguish bit order from polynomial notation?

The chosen convention determines which taps and shifts implement the polynomial.

A 4-bit LFSR starts in all-zero state. What happens with XOR feedback?

The register remains zero. It cannot enter the nonzero maximal-length cycle.

A primitive degree-4 polynomial is used with a nonzero seed. What period is expected?

\(2^{4}\)−1=15, provided the implemented tap and shift convention matches that polynomial.

Why record the initial register and bit ordering?

Different conventions can produce different sequences from the same printed polynomial and seed.

Shared research workbenches · network designer & advanced studies
Concurrent-device simulation & Monte Carlo research
Distributed digital twin · topology, protocol & battery research