IoTPSUT IoT Engineering StudioPrincess Sumaya University for Technology · Dr. Mohammad Alja’afreh
CRYPTOGRAPHY ENGINEERING · CR06 · DES
IoT Security and Privacy
DES · plaintext and effective-key avalanche
Compute d=popcount(A XOR B); report 100d/64.
CR06 · Laboratory mentorAsk about the current operation and its intermediate values.
CR06 · Academic orientation
Scope and objectives
Scope of the experiment
DES parity checks representation and does not contribute to its effective secret. Changing a parity-only bit leaves PC-1 and all subkeys unchanged. Changing an effective key bit can alter round trajectories.
The focus of this experiment is to define Hamming distance between equal-length DES states. Students then compare effective-key and parity-bit perturbations at corresponding rounds, and explain why a single avalanche observation is not a security proof. 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
Define Hamming distance between equal-length DES states.
Compare effective-key and parity-bit perturbations at corresponding rounds.
Explain why a single avalanche observation is not a security proof.
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 define Hamming distance between equal-length DES states, compare effective-key and parity-bit perturbations at corresponding rounds, and explain why a single avalanche observation is not a security proof.
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 a single avalanche observation is not a security proof. Separate predicted values from observations.
Prerequisite knowledge and related learning
Use the curriculum sequence and the Concepts section for prerequisite terminology. After completion, continue to DES · double encryption and Triple DES EDE.
Environment and experimental methodology
A standard browser and the experiment-specific Python implementation or Colab notebook. Where the practical uses a protocol model, model results are distinguished from actual local cryptographic operations.
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.
01 · Experiment overview
CR06 · DES · plaintext and effective-key avalanche
Compute d=popcount(A XOR B); report 100d/64. Compare corresponding L||R after IP and each round. In separate trials flip one plaintext bit and one key bit; bit 0 in the supplied key is parity, bit 1 is effective.
Before starting
Environment: standard computer, browser and Python/WSL.
Simulation: Editable JavaScript calculation
Technical scope: Classroom computation on a standard computer. Educational cipher code is not a production security implementation.
Complete the six stages in order. Use the same experiment inputs when comparing manual, browser and Python results.
02 · Concepts and mathematical foundations
Compute d=popcount(A XOR B); report 100d/64. Compare corresponding L||R after IP and each round. In separate trials flip one plaintext bit and one key bit; bit 0 in the supplied key is parity, bit 1 is effective.
Learning objectives
Calculate the named operation, inspect its intermediate values, reproduce the result in Python, and explain one controlled change. Prerequisites: binary/hexadecimal arithmetic; complete preceding labs in the same topic where applicable.
Before starting
Environment: standard computer, browser and Python/WSL.
Simulation: Editable JavaScript calculation
Technical scope: Classroom computation on a standard computer. Educational cipher code is not a production security implementation.
Avalanche versus parity
1 · Principles and purpose
DES parity checks representation and does not contribute to its effective secret. Changing a parity-only bit leaves PC-1 and all subkeys unchanged. Changing an effective key bit can alter round trajectories.
2 · Mathematical and algorithmic foundations
Compute \(d_{i}\)=popcount((\(L_{i}\)||\(R_{i}\))⊕(L′ᵢ||R′ᵢ)), denominator 64. For key perturbations compare PC-1 first; for plaintext perturbations compare IP first.
A parity-only perturbation leaves all distances zero when effective key bits and plaintext are fixed. Effective-key distances are input-dependent. Neither this test nor the strict avalanche criterion establishes resistance to all attacks.
Captured earlier local execution. Randomized values and timing can differ; compare the invariant.
4 · Verification and experimental interpretation
Step through the following visualization and compare the named operation with the corresponding computed state. Check the mathematical invariant, inverse operation or protocol acceptance condition. Change one input at a time; distinguish a measured output from a prediction.
Mathematical representation and interpretation
Normalized Hamming distance
A and B are corresponding w-bit states; wt counts the one bits. Compare equal-width states at the same transformation boundary.
For w=8 and states 0xA5 and 0xA1, XOR gives 0x04: one changed bit, or 12.5%.
Concept animation · DES avalanche measurements
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.
Step 1 of 17 · IP
Teaching example only; inspect live calculations or real practical evidence separately.
IP
base
CC00CCFFF0AAF0AA
plaintext_flip
CC00CCFFF0AAF02A
key_flip
CC00CCFFF0AAF0AA
plaintext_bits
1
key_bits
0
plaintext_pct
1.5625
key_pct
0.0
Round 1
base
F0AAF0AAEF4A6544
plaintext_flip
F0AAF02AFD4A4145
key_flip
F0AAF0AAEF4A6145
plaintext_bits
6
key_bits
2
plaintext_pct
9.375
key_pct
3.125
Round 2
base
EF4A6544CC017709
plaintext_flip
FD4A4145F50D77A1
key_flip
EF4A6145F40575A3
plaintext_bits
14
key_bits
11
plaintext_pct
21.875
key_pct
17.1875
Round 3
base
CC017709A25C0BF4
plaintext_flip
F50D77A12CEE20DF
key_flip
F40575A368A479F6
plaintext_bits
25
key_bits
23
plaintext_pct
39.0625
key_pct
35.9375
Round 4
base
A25C0BF477220045
plaintext_flip
2CEE20DF90CC68B4
key_flip
68A479F66FC70A57
plaintext_bits
36
key_bits
25
plaintext_pct
56.25
key_pct
39.0625
Round 5
base
772200458A4FA637
plaintext_flip
90CC68B4DF5F8891
key_flip
6FC70A574B6DE9CB
plaintext_bits
33
key_bits
27
plaintext_pct
51.5625
key_pct
42.1875
Round 6
base
8A4FA637E967CD69
plaintext_flip
DF5F88911943F5FC
key_flip
4B6DE9CB68F9E3C1
plaintext_bits
26
key_bits
30
plaintext_pct
40.625
key_pct
46.875
Round 7
base
E967CD69064ABA10
plaintext_flip
1943F5FC363FDB56
key_flip
68F9E3C112887D16
plaintext_bits
26
key_bits
26
plaintext_pct
40.625
key_pct
40.625
Round 8
base
064ABA10D5694B90
plaintext_flip
363FDB56F724F939
key_flip
12887D1696330A07
plaintext_bits
27
key_bits
26
plaintext_pct
42.1875
key_pct
40.625
Round 9
base
D5694B90247CC67A
plaintext_flip
F724F9390664CF7D
key_flip
96330A071023B720
plaintext_bits
23
key_bits
31
plaintext_pct
35.9375
key_pct
48.4375
Round 10
base
247CC67AB7D5D7B2
plaintext_flip
0664CF7DCAE5D272
key_flip
1023B72031DF7C29
plaintext_bits
21
key_bits
32
plaintext_pct
32.8125
key_pct
50.0
Round 11
base
B7D5D7B2C5783C78
plaintext_flip
CAE5D272E798A421
key_flip
31DF7C29E7A58C7B
plaintext_bits
24
key_bits
28
plaintext_pct
37.5
key_pct
43.75
Round 12
base
C5783C7875BD1858
plaintext_flip
E798A421D0394485
key_flip
E7A58C7B0776CBBF
plaintext_bits
28
key_bits
33
plaintext_pct
43.75
key_pct
51.5625
Round 13
base
75BD185818C3155A
plaintext_flip
D03944855A6EF8D8
key_flip
0776CBBFDB9B23BD
plaintext_bits
31
key_bits
37
plaintext_pct
48.4375
key_pct
57.8125
Round 14
base
18C3155AC28C960D
plaintext_flip
5A6EF8D80F6208F1
key_flip
DB9B23BDBE6AB1CB
plaintext_bits
37
key_bits
35
plaintext_pct
57.8125
key_pct
54.6875
Round 15
base
C28C960D43423234
plaintext_flip
0F6208F156BB815C
key_flip
BE6AB1CB71DAAF6E
plaintext_bits
39
key_bits
33
plaintext_pct
60.9375
key_pct
51.5625
Round 16
base
434232340A4CD995
plaintext_flip
56BB815C6A5C2613
key_flip
71DAAF6E85754544
plaintext_bits
31
key_bits
32
plaintext_pct
48.4375
key_pct
50.0
Shared research workbenches · network designer & advanced studiesConcurrent-device simulation & Monte Carlo research
Verified baseline reference — use the live workstation below to explore steps and compare inputs.
Edit the fields and choose Recompute. Use step controls to inspect real calculated states. Hexadecimal byte fields are written without 0x; numeric fields accept decimal or 0x notation.
Use the baseline inputs shown above. Predict a result, advance one operation at a time, inspect the intermediate state, then change only the parameter specified in the Experiments view. Export the trace and compare it with your manual derivation.
Compute d=popcount(A XOR B); report 100d/64. Compare corresponding L||R after IP and each round. In separate trials flip one plaintext bit and one key bit; bit 0 in the supplied key is parity, bit 1 is effective.
Predict the baseline result before revealing the calculated state. A controlled comparison changes the named input while keeping the other conditions fixed. Record an observed value separately from an expected value.
Part A · Independent theoretical exercises
Complete each question before running the simulator or Python. Show calculations or protocol traces. The teaching example is a method, not a substitute for the assigned values.
01 · Application and derivation
Application and derivation · Independent work
Choose the baseline DES plaintext and key. Flip one effective key bit and one parity bit in separate trials. Predict the effect on PC-1, then compute Hamming distance for the first and final displayed round states. Explain the distinction.
Application and derivation — Compute \(d_{i}\)=popcount((\(L_{i}\)||\(R_{i}\))⊕(L′ᵢ||R′ᵢ)), denominator 64. For key perturbations compare PC-1 first; for plaintext perturbations compare IP first. Apply this method to the assigned values independently; compare your reasoning with the relevant simulator or practical implementation.
02 · Data interpretation
Data interpretation · Independent work
Two hypothetical DES states are 0x0000000000000000 and 0x8000000000000003. Compute bit distance and percentage. Is this enough to establish the strict avalanche criterion?
Data interpretation — Review the defining equations and compare the input restrictions and state transitions in Concepts. Apply this method to the assigned values independently; compare your reasoning with the relevant simulator or practical implementation.
Required evidence: state the expected invariant or acceptance condition; record hand-derived results, compare with the simulator or Python trace, and explain the first discrepancy. Do not report a predicted value as a measurement.
Expanded independent theoretical exercise bank
Progress from calculation and interpretation to diagnosis and controlled engineering design. Complete the questions without opening the simulation first; show intermediate steps.
Intermediate · Alternate configuration
Independent theoretical exercise · CR06-01
For the separate teaching-test configuration plaintext: 0123456789ABCDEF; key: 133457799BBCDFF1; bit: 0, predict plaintext_bits using the relevant operation or decision rule. Show intermediate work and state whether this is a deterministic result.
Intermediate · Interpret a computation state
Independent theoretical exercise · CR06-02
A teaching trace for DES · plaintext and effective-key avalanche contains step: Round 1; base: F0AAF0AAEF4A6544; plaintext_flip: F0AAF02AFD4A4145; key_flip: F0AAF0AAEF4A6145; plaintext_bits: 6. Explain the role of key_pct (recorded value 3.125) and identify the rule or input that determines it. Distinguish an intermediate state from the final result.
Intermediate · Compare two recorded states
Independent theoretical exercise · CR06-03
The first and final trace records show plaintext_bits = 1 and 31. Calculate the signed difference and explain whether it is an operation count, a state value or a measurement.
Challenging · Controlled algorithm verification
Independent theoretical exercise · CR06-04
Plan a comparison of plaintext: 0123456789ABCDEF; key: 133457799BBCDFF1; bit: 1 with plaintext: 0123456789ABCDEF; key: 133457799BBCDFF1; bit: 0. Record the dependent value plaintext_bits, identify the changed factor(s), and describe the verification and failure criterion without claiming a real security measurement.
Part B · Guided simulation and practical procedure
Before starting — tools and setup
Standard computer; extract the WSL toolkit into a new directory. For the browser activity, use the integrated workstation. Editable browser calculation
Install Python dependencies only if required by the selected toolkit README. Use its requirements file and virtual environment instructions.
Part E/F · Independent Python verification and deliverables
Download the notebook or toolkit and run the default example.
Reproduce at least one changed input; compare the intermediate values with the browser where supported.
Complete the independent assessment below without copying the worked baseline. Explain discrepancies and distinguish mathematical results from security claims.
Additional investigation instructions
A controlled comparison changes one independent input while holding other inputs fixed, then measures its effect on the dependent output. A baseline is the unmodified run. Evidence-based reasoning means citing the actual observed values, not merely asserting that an algorithm is secure.
Run the supplied default values and record the first and final state.
Predict the effect before changing anything. Change bit 1 to 0, then 7. First verified alternate: {"bit": "0"}.
Keep base block and key.
Measure round-by-round plaintext and key distance (bits and percent).
Restore the baseline and repeat with another valid input. Locate the first differing calculation.
Submit a comparison table, a trace JSON or screenshots of relevant steps, and a short conclusion with an explicit limitation.
Trial
Changed input
Fixed conditions
Prediction
Measured value
Reason / limitation
Baseline
None
Default
Student prediction
Record trace
Explain
Trial 1
Specified change
Unchanged inputs
Student prediction
Record trace
Explain
Part C · Python, Google Colab and WSL
The standalone implementation uses the same synthetic baseline and calculations as the browser. In Colab, download the notebook, open Colab and upload it using File → Upload notebook. Run all cells in order.
Use Ubuntu or Kali WSL, not PowerShell. Download the toolkit above to your computer. If Python, venv or unzip is missing, install these prerequisites once (requires administrator permission and network access).
In WSL, enter the actual downloaded ZIP path when prompted (for example, a file under /mnt/c/Users/…/Downloads). Extract to a new, dedicated directory. If this directory already exists from a previous extraction, use the existing verified toolkit or choose a clean directory rather than overwriting it.
Step 1 · Extract · bash
read -r -p "Full path to PSUT_V22_9_9_Cryptography_WSL.zip: " ZIP
DEST="$HOME/psut-crypto-v22.9.9"
if [ -f "$ZIP" ] && [ ! -e "$DEST" ]; then
mkdir "$DEST" && unzip "$ZIP" -d "$DEST"
else
echo "Check ZIP path and use a fresh destination."
fi
Create the isolated environment in the extracted toolkit root, activate it, then enter this experiment’s actual folder. Install only its declared dependencies. A comment-only requirements file requires no third-party packages.
Step 2 · Activate and install · bash
cd ~/psut-crypto-v22.9.9
python3 -m venv .venv
source .venv/bin/activate
cd CR06
ls
python -m pip install -r requirements.txt
Execute the default run and save the genuine program output. Then run the supplied regression test and the baseline fixture through the explicit input interface.
To change inputs, copy example-input.json, edit the copy in a text editor and run the command below. The original fixture is preserved.
Step 4 · Change an input · bash
cp example-input.json my-input.json
# Edit my-input.json with your preferred editor.
python lab.py --params my-input.json
These scripts terminate normally. Use Ctrl+C to stop a long-running calculation if needed. When finished, leave the isolated virtual environment; no global service cleanup is required for these local examples.
Step 5 · Finish · bash
deactivate
Declared dependencies: # Standard library only for core experiment
Expected terminal output — captured local execution
This excerpt contains the actual first trace step and final result from python lab.py, followed by the actual regression test output. Full stdout is in CR06/verified-output.txt inside the toolkit. Timing, random signatures, keys, certificate fields and implementation-dependent sizes can vary; compare the invariant and record your own observations.
Check the output JSON and the test exit status. An assertion error means the expected invariant was not met. If Python reports a missing module, activate the environment and install the experiment’s requirements file; if a file is missing, check pwd and ls.
What check must you reproduce before varying the inputs?
For bit=0 the effective-key distance is zero in every round because PC-1 excludes parity. The plaintext distance need not be zero.
Which observations belong in your experimental record?
Round, two Hamming distances and percentages. Plot both series.
06 · Knowledge assessment
Formative check
Which experimental design best isolates the effect of the specified input?
Responses are for instructor review; no grading key is provided here.
Independent assessment
Run bit 0 and bit 9 separately; compare final and round-4 plaintext/key Hamming distances. Explain why bit 0 does not change the DES subkeys. Use an additional valid trial, a calculation or a counterexample to support your reasoning. Submit evidence from both runtimes and explain what the experiment does not establish.
Part F · Engineering evidence record
Record the baseline, prediction, changed input, observed result, discrepancy and limitation. Save locally or export with the displayed result. This is not an official submission.