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 CR03 — full DES trace and CR04–CR08 →

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

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

DES — S-boxes, Feistel rounds and avalanche

Trace DES bit permutations, subkey generation and round functions; quantify nonlinearity and the avalanche effect.

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

Scope and objectives

Scope of the experiment

Trace DES bit permutations, subkey generation and round functions; quantify nonlinearity and the avalanche effect.

The focus of this experiment is to trace DES permutation, S-box lookup and Feistel rounds. Students then calculate subkey mixing and compare Hamming-distance trials, and verify known-answer behavior and explain legacy limitations. 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

  • Trace DES permutation, S-box lookup and Feistel rounds.
  • Calculate subkey mixing and compare Hamming-distance trials.
  • Verify known-answer behavior and explain legacy limitations.
  • 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 trace DES permutation, S-box lookup and Feistel rounds, calculate subkey mixing and compare Hamming-distance trials, and verify known-answer behavior and explain legacy limitations.

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 verify known-answer behavior and explain legacy limitations. 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 AES mathematics — Galois fields and block transformations.

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 DES — S-boxes, Feistel rounds and avalanche

Trace DES bit permutations, subkey generation and round functions; quantify nonlinearity and the avalanche effect.

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: Trace DES bit permutations, subkey generation and round functions; quantify nonlinearity and the avalanche effect.

  1. Complete the analytical preparation below before programming. Show the intermediate mathematical calculations.
  2. S-box nonlinearity — complete its numbered steps and record the requested evidence.
  3. DES initial permutation and key schedule — complete its numbered steps and record the requested evidence.
  4. Plaintext avalanche assigned bit 57 — complete its numbered steps and record the requested evidence.

Reference check: The known-answer ciphertext is 85E813540F0AB405. The nonlinearity example differs. A parity-only key flip leaves the effective key and ciphertext unchanged.

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. S-box nonlinearity — 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 · EC07 · DES — S-boxes, Feistel rounds and avalanche

Expansion, key mixing, eight S-boxes, permutation P and Feistel word exchange.
Expansion, key mixing, eight S-boxes, permutation P and Feistel word exchange.

Block and effective key

DES encrypts a 64-bit block with a 56-bit effective key. The 64-bit key encoding includes eight parity bits, which PC-1 removes. The initial permutation rearranges plaintext bits before the 16-round Feistel network; the final permutation is its inverse after the final swap.

Nonlinear round function

The expansion E maps 32 right-half bits to 48. XOR with the 48-bit subkey, split into eight six-bit groups and apply S1 through S8. Concatenate the four-bit outputs, then apply permutation P. Update \(L_{i}\)=\(R_{i-1}\) and \(R_{i}\)=\(L_{i-1}\) XOR F(\(R_{i-1}\),\(K_{i}\)). The S-box row is the two outer bits and the column is the four inner bits.

Key schedule and avalanche

PC-1 forms two 28-bit halves. Scheduled circular left shifts and PC-2 generate each round subkey. Flip exactly one plaintext bit, one effective key bit, or one parity bit in separate trials; measure Hamming distance between corresponding states. DES is obsolete for real security. Its role here is to explain bit-level transformations.

Prerequisites: EC06 and earlier foundations as applicable.

EC07 engineering diagram
Algorithm structure and data flow. Use the simulation to inspect the corresponding numerical transformations.
DES S-box lookup
Six input bits determine the S-box lookup coordinates.

DES substitution tables — S1 through S8

Row 3 · Column 2 · S1 = 8 (1000)

Each DES S-box maps six input bits to four output bits. Select the row using the two outer bits and the column using the four inner bits.

S1 — decimal values, row/column indices start at 0
r/c0123456789101112131415
01441312151183106125907
10157414213110612119538
24114813621115129731050
31512824917511314100613
S2 — decimal values, row/column indices start at 0
r/c0123456789101112131415
01518146113497213120510
13134715281412011069115
20147111041315812693215
31381013154211671205149
S3 — decimal values, row/column indices start at 0
r/c0123456789101112131415
01009146315511312711428
11370934610285141211151
21364981530111212510147
31101306987415143115212
S4 — decimal values, row/column indices start at 0
r/c0123456789101112131415
07131430691012851112415
11381156150347212110149
21069012117131513145284
33150610113894511127214
S5 — decimal values, row/column indices start at 0
r/c0123456789101112131415
02124171011685315130149
11411212471315015103986
24211110137815912563014
31181271142136150910453
S6 — decimal values, row/column indices start at 0
r/c0123456789101112131415
01211015926801334147511
11015427129561131401138
29141552812370410113116
34321295151011141760813
S7 — decimal values, row/column indices start at 0
r/c0123456789101112131415
04112141508133129751061
11301174911014351221586
21411131237141015680592
36111381410795015142312
S8 — decimal values, row/column indices start at 0
r/c0123456789101112131415
01328461511110931450127
11151381037412561101492
27114191214206101315358
32114741081315129035611

DES bit permutation tables

Read left to right, top to bottom. Entries are one-based input bit positions. These are the exact permutation tables used in the experiment engine.

IP — 64 output bits
585042342618102
605244362820124
625446383022146
645648403224168
57494133251791
595143352719113
615345372921135
635547393123157
PC1 — 56 output bits
5749413325179
1585042342618
1025951433527
1911360524436
63554739312315
7625446383022
1466153453729
211352820124
PC2 — 48 output bits
1417112415
3281562110
2319124268
1672720132
415231374755
304051453348
444939563453
464250362932
E — 48 output bits
3212345
456789
8910111213
121314151617
161718192021
202122232425
242526272829
28293031321
P — 32 output bits
167202129122817
11523265183110
282414322739
19133062211425

Engineering diagrams

Feistel round and round-key generation.
Feistel round and round-key generation.

Scientific foundations and worked examples

Complete DES processing chain

DES transforms a 64-bit input by IP, splits it into \(L_{0}\),\(R_{0}\), performs 16 rounds \(L_{i}\)=\(R_{i-1}\) and \(R_{i}\)=\(L_{i-1}\) XOR F(\(R_{i-1}\),\(K_{i}\)), swaps the halves and applies IP⁻¹. F expands R to 48 bits, XORs the subkey, splits into eight six-bit chunks, substitutes to 32 bits and applies P. Decryption uses the same Feistel structure with reversed subkey order. A Feistel round is invertible even if F is not.

S-box indexing and nonlinear worked example

The first and sixth bits form the two-bit row index, while the middle four select a column. For S1(000000)=14 and S1(000001)=0, the XOR of outputs is 14 while S1(000000 XOR 000001)=0. Thus the substitution is not linear. For S1(100101), row=3, column=2 and output=8. All eight tables below allow manual reproduction of each chunk. The DES S-box design criterion for one-bit input differences is at least two output bits per affected box; later permutations redistribute these changes.

Key schedule and avalanche methodology

PC-1 removes every eighth parity bit and permutes the remaining 56 bits into two 28-bit halves. Rotate each half by one position in rounds 1,2,9,16 and by two in other rounds, then PC-2 selects 48 bits. The sum of shifts is 28. All-zero and all-one key encodings fail odd parity, but are usable as mathematical effective-key fixtures in a permissive teaching implementation; real APIs may reject or correct parity. Track the changed bit through PC-1, rotations and PC-2. Compare plaintext-bit-57 and first-key-bit cases against an unchanged baseline using XOR and Hamming distance. DES is obsolete for new security systems.

Engineering principles · additional worked teaching example

DES maps 64-bit blocks through 16 Feistel rounds; PC-1 discards eight parity bits of the supplied 64-bit key. For S-box input 101011, row is outer bits 11=3 and column 0101=5; use the specified S-box lookup, not integer conversion of all six bits.

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

DES expands 32 bits to 48, combines a subkey using XOR, substitutes eight 6-bit groups into 4-bit groups, permutes, and applies a reversible Feistel exchange. For S1 input 000000 row 0 column 0 yields 14.

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.

DES — S-boxes, Feistel rounds and avalanche: operation pathwayExpand R32 → 48 bitsKey mixing48-bit XOREight S-boxes8 × 6 → 8 × 4 bitsPermutation +Feistel32-bit output; XORLRead the active operation, then inspect the accumulated state.

Step 1 of 4 · Expand R

Expand R

Expand R
32 → 48 bits

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
How many DES rounds?

16 Feistel rounds.

What is the effective key size?

56 bits excluding parity.

What does an S-box do?

Nonlinear mapping of 6 bits to 4 bits.

Why not deploy DES?

Its key space is too small for contemporary security.

How is the DES S-box row selected?

Combine the first and last bits as a two-bit integer.

How is the column selected?

Use the middle four bits as a four-bit integer.

What is S1(100101)?

8 (1000): row 3, column 2.

What is S2(100101)?

10 (1010): row 3, column 2.

What is S1(000000)?

14 (1110).

What is S1(000001)?

0 (0000).

Why does the XOR experiment show nonlinearity?

S1(0) XOR S1(1)=14, while S1(0 XOR 1)=0.

How many bits does DES expansion produce?

48, from a 32-bit right half.

What is the purpose of PC-1?

Remove eight parity bits and permute the effective key into 56 bits.

What happens when only a DES parity bit is flipped?

The effective key and ciphertext do not change.

Where does the P permutation act?

On the concatenated 32-bit S-box output.

What does Hamming distance measure?

The number of differing bit positions.

DES S1 receives 100101. Which table entry is selected?

Outer bits 11 select row 3. Inner bits 0010 select column 2. S1 returns 8 (\(1000_{2}\)).

A DES parity bit is flipped, but the other 56 key bits remain fixed. What should happen?

PC-1 discards the parity bits. If the implementation accepts the changed encoding, the effective key and ciphertext remain unchanged.

A student wants to replace a DES S-box with a linear map. What property is lost?

The nonlinearity that frustrates linear and differential approximations. A reversible Feistel structure alone is not sufficient for security.

At the output of E, why are there 48 bits rather than 32?

E duplicates selected boundary bits and arranges eight overlapping six-bit groups for subkey XOR and substitution.

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