Skip to main content
IoT
PSUT Engineering StudioPrincess Sumaya University for Technology
Student Edition
Cyber Defense StudioIoT Security and PrivacyExperimentsWorkspaces
Home / IoT Security and Privacy / Cryptography Engineering
IoTPSUT IoT Engineering StudioPrincess Sumaya University for Technology · Dr. Mohammad Alja’afreh
CRYPTOGRAPHY ENGINEERING · CR05 · DES
IoT Security and Privacy

DES · PC-1, rotations and PC-2

PC-1 selects 56 key bits into \(C_{0}\),\(D_{0}\) (28 bits each).

CR05 · Laboratory mentorAsk about the current operation and its intermediate values.
CR05 · Academic orientation

Scope and objectives

Scope of the experiment

PC-1 drops parity bits at one-based positions 8,16,…,64 and permutes 56 effective bits. C and D are two 28-bit halves. The shift schedule uses one-bit rotations in rounds 1,2,9,16 and two in the others.

The focus of this experiment is to remove parity positions with PC-1 and rotate the 28-bit halves. Students then derive selected 48-bit round subkeys with PC-2, and verify the schedule and distinguish parity from effective key bits. 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

  • Remove parity positions with PC-1 and rotate the 28-bit halves.
  • Derive selected 48-bit round subkeys with PC-2.
  • Verify the schedule and distinguish parity from effective key bits.
  • 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 remove parity positions with PC-1 and rotate the 28-bit halves, derive selected 48-bit round subkeys with PC-2, and verify the schedule and distinguish parity from effective key bits.

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 the schedule and distinguish parity from effective key bits. 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 · plaintext and effective-key avalanche.

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

CR05 · DES · PC-1, rotations and PC-2

PC-1 selects 56 key bits into \(C_{0}\),\(D_{0}\) (28 bits each). Rotations use schedule 1,1,2,2,2,2,2,2,1,2,2,2,2,2,2,1. PC-2 selects 48 bits. Flipping the least significant bit of each supplied byte changes parity only.

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

PC-1 selects 56 key bits into \(C_{0}\),\(D_{0}\) (28 bits each). Rotations use schedule 1,1,2,2,2,2,2,2,1,2,2,2,2,2,2,1. PC-2 selects 48 bits. Flipping the least significant bit of each supplied byte changes parity only.

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.

DES key scheduling

1 · Principles and purpose

PC-1 drops parity bits at one-based positions 8,16,…,64 and permutes 56 effective bits. C and D are two 28-bit halves. The shift schedule uses one-bit rotations in rounds 1,2,9,16 and two in the others.

2 · Mathematical and algorithmic foundations

\(C_{i}\)=ROTL28(\(C_{i-1}\),\(s_{i}\)), likewise D; \(K_{i}\)=PC-2(\(C_{i}\)||\(D_{i}\)). PC-2 selects 48 bits. Rotation is not a logical shift: displaced bits wrap back.

\[\begin{aligned}C_i&=\operatorname{ROTL}_{28}(C_{i-1},s_i)\\D_i&=\operatorname{ROTL}_{28}(D_{i-1},s_i)\\K_i&=\operatorname{PC2}(C_i\parallel D_i)\end{aligned}\]

3 · Worked teaching example

Key 133457799BBCDFF1 produces C0=F0CCAAF, D0=556678F. After one-bit rotations C1=E19955F,D1=AACCF1E; PC-2 gives 1B02EFFC7072. Reversing the subkey order supports decryption.

Verified default trace · 16 intermediate states

Given parameters (teaching example):

{
  "key": "133457799BBCDFF1"
}
StageComputed values
1{ "step": "Round 1", "C": "E19955F", "D": "AACCF1E", "rotation": 1, "K": "1B02EFFC7072" }
2{ "step": "Round 2", "C": "C332ABF", "D": "5599E3D", "rotation": 1, "K": "79AED9DBC9E5" }
3{ "step": "Round 3", "C": "0CCAAFF", "D": "56678F5", "rotation": 2, "K": "55FC8A42CF99" }
4{ "step": "Round 4", "C": "332ABFC", "D": "599E3D5", "rotation": 2, "K": "72ADD6DB351D" }
5{ "step": "Round 5", "C": "CCAAFF0", "D": "6678F55", "rotation": 2, "K": "7CEC07EB53A8" }
6{ "step": "Round 6", "C": "32ABFC3", "D": "99E3D55", "rotation": 2, "K": "63A53E507B2F" }
7{ "step": "Round 7", "C": "CAAFF0C", "D": "678F556", "rotation": 2, "K": "EC84B7F618BC" }
8{ "step": "Round 8", "C": "2ABFC33", "D": "9E3D559", "rotation": 2, "K": "F78A3AC13BFB" }
9{ "step": "Round 9", "C": "557F866", "D": "3C7AAB3", "rotation": 1, "K": "E0DBEBEDE781" }
10{ "step": "Round 10", "C": "55FE199", "D": "F1EAACC", "rotation": 2, "K": "B1F347BA464F" }
11{ "step": "Round 11", "C": "57F8665", "D": "C7AAB33", "rotation": 2, "K": "215FD3DED386" }
12{ "step": "Round 12", "C": "5FE1995", "D": "1EAACCF", "rotation": 2, "K": "7571F59467E9" }
13{ "step": "Round 13", "C": "7F86655", "D": "7AAB33C", "rotation": 2, "K": "97C5D1FABA41" }
14{ "step": "Round 14", "C": "FE19955", "D": "EAACCF1", "rotation": 2, "K": "5F43B7F2E73A" }
15{ "step": "Round 15", "C": "F866557", "D": "AAB33C7", "rotation": 2, "K": "BF918D3D3F0A" }
16{ "step": "Round 16", "C": "F0CCAAF", "D": "556678F", "rotation": 1, "K": "CB3D8B0E17F5" }

Recorded result

{
  "subkeys": 16,
  "last": "CB3D8B0E17F5"
}

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

DES key scheduling

K contains parity positions; PC-1 selects the effective bits. Both 28-bit halves rotate by the round-dependent shift s_i; PC-2 selects a 48-bit round key.

\[(C_0,D_0)=\operatorname{PC1}(K),\quad K_i=\operatorname{PC2}(\operatorname{ROTL}_{s_i}(C_{i-1})\parallel\operatorname{ROTL}_{s_i}(D_{i-1}))\]

Concept animation · DES key rotation and selection

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 key schedule — two circular 28-bit registersC after rotateE19955FD after rotateAACCF1ECircular left rotation: 1 bit(s)Concatenate C and D · PC-2E19955FAACCF1ERound 1 · 48-bit subkey1B02EFFC7072DES key schedule — two circular 28-bit registersC after rotateC332ABFD after rotate5599E3DCircular left rotation: 1 bit(s)Concatenate C and D · PC-2C332ABF5599E3DRound 2 · 48-bit subkey79AED9DBC9E5DES key schedule — two circular 28-bit registersC after rotate0CCAAFFD after rotate56678F5Circular left rotation: 2 bit(s)Concatenate C and D · PC-20CCAAFF56678F5Round 3 · 48-bit subkey55FC8A42CF99DES key schedule — two circular 28-bit registersC after rotate332ABFCD after rotate599E3D5Circular left rotation: 2 bit(s)Concatenate C and D · PC-2332ABFC599E3D5Round 4 · 48-bit subkey72ADD6DB351DDES key schedule — two circular 28-bit registersC after rotateCCAAFF0D after rotate6678F55Circular left rotation: 2 bit(s)Concatenate C and D · PC-2CCAAFF06678F55Round 5 · 48-bit subkey7CEC07EB53A8DES key schedule — two circular 28-bit registersC after rotate32ABFC3D after rotate99E3D55Circular left rotation: 2 bit(s)Concatenate C and D · PC-232ABFC399E3D55Round 6 · 48-bit subkey63A53E507B2FDES key schedule — two circular 28-bit registersC after rotateCAAFF0CD after rotate678F556Circular left rotation: 2 bit(s)Concatenate C and D · PC-2CAAFF0C678F556Round 7 · 48-bit subkeyEC84B7F618BCDES key schedule — two circular 28-bit registersC after rotate2ABFC33D after rotate9E3D559Circular left rotation: 2 bit(s)Concatenate C and D · PC-22ABFC339E3D559Round 8 · 48-bit subkeyF78A3AC13BFBDES key schedule — two circular 28-bit registersC after rotate557F866D after rotate3C7AAB3Circular left rotation: 1 bit(s)Concatenate C and D · PC-2557F8663C7AAB3Round 9 · 48-bit subkeyE0DBEBEDE781DES key schedule — two circular 28-bit registersC after rotate55FE199D after rotateF1EAACCCircular left rotation: 2 bit(s)Concatenate C and D · PC-255FE199F1EAACCRound 10 · 48-bit subkeyB1F347BA464FDES key schedule — two circular 28-bit registersC after rotate57F8665D after rotateC7AAB33Circular left rotation: 2 bit(s)Concatenate C and D · PC-257F8665C7AAB33Round 11 · 48-bit subkey215FD3DED386DES key schedule — two circular 28-bit registersC after rotate5FE1995D after rotate1EAACCFCircular left rotation: 2 bit(s)Concatenate C and D · PC-25FE19951EAACCFRound 12 · 48-bit subkey7571F59467E9DES key schedule — two circular 28-bit registersC after rotate7F86655D after rotate7AAB33CCircular left rotation: 2 bit(s)Concatenate C and D · PC-27F866557AAB33CRound 13 · 48-bit subkey97C5D1FABA41DES key schedule — two circular 28-bit registersC after rotateFE19955D after rotateEAACCF1Circular left rotation: 2 bit(s)Concatenate C and D · PC-2FE19955EAACCF1Round 14 · 48-bit subkey5F43B7F2E73ADES key schedule — two circular 28-bit registersC after rotateF866557D after rotateAAB33C7Circular left rotation: 2 bit(s)Concatenate C and D · PC-2F866557AAB33C7Round 15 · 48-bit subkeyBF918D3D3F0ADES key schedule — two circular 28-bit registersC after rotateF0CCAAFD after rotate556678FCircular left rotation: 1 bit(s)Concatenate C and D · PC-2F0CCAAF556678FRound 16 · 48-bit subkeyCB3D8B0E17F5

Step 1 of 16 · Round 1

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

Round 1

C
E19955F
D
AACCF1E
rotation
1
K
1B02EFFC7072
Shared research workbenches · network designer & advanced studies
Concurrent-device simulation & Monte Carlo research
Distributed digital twin · topology, protocol & battery research

03 · Interactive simulation

Baseline diagram loaded. Interactive engine initializing…

Verified baseline reference — use the live workstation below to explore steps and compare inputs.
CR05 calculated stateDES key schedule · rotate two 28-bit halvesSupplied key · 64 bits133457799BBCDFF1PC-1: remove parity56 effective bitsC · rotate 1C332ABFD · rotate 15599E3DPC-2 · 48-bit round key79AED9DBC9E5Round 2 · PC-2 selects 48 of the 56 rotated bits

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.

Calculated result

{
  "subkeys": 16,
  "last": "CB3D8B0E17F5"
}
All intermediate trace rows

Guided simulation activity

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.

Continue to practical experiments →

04 · Experiments and engineering investigations

Analytical preparation — before Python

PC-1 selects 56 key bits into \(C_{0}\),\(D_{0}\) (28 bits each). Rotations use schedule 1,1,2,2,2,2,2,2,1,2,2,2,2,2,2,1. PC-2 selects 48 bits. Flipping the least significant bit of each supplied byte changes parity only.

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

For key 133457799BBCDFF1, apply PC-1, split into C0/D0, rotate each by the first and second specified shift amounts, apply PC-2, and list K1 and K2. Identify which eight input positions are parity bits.

02 · Boundary analysis

Boundary analysis · Independent work

If C0=0x8000001, calculate a one-bit circular left rotation on 28 bits, then another two-bit rotation.

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 · CR05-01

For the separate teaching-test configuration key: 133457799BBCDFF0, predict subkeys 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 · CR05-02

A teaching trace for DES · PC-1, rotations and PC-2 contains step: Round 2; C: C332ABF; D: 5599E3D; rotation: 1; K: 79AED9DBC9E5. Explain the role of K (recorded value 79AED9DBC9E5) and identify the rule or input that determines it. Distinguish an intermediate state from the final result.

Advanced · Identify a terminal invariant

Independent theoretical exercise · CR05-03

The first teaching trace contains step: Round 1; C: E19955F; D: AACCF1E; rotation: 1; K: 1B02EFFC7072; the last contains step: Round 16; C: F0CCAAF; D: 556678F; rotation: 1; K: CB3D8B0E17F5. Identify one distinction between the initial operation and completion. What additional condition must hold to use the result?

Challenging · Controlled algorithm verification

Independent theoretical exercise · CR05-04

Plan a comparison of key: 133457799BBCDFF1 with key: 133457799BBCDFF0. Record the dependent value last, 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.

Open complete, verified WSL commands in Part C ↓

01

Inspect the DES key schedule

  1. Use the exact baseline input below and write a prediction.
  2. Use 133457799BBCDFF1. Trace the first two rotations of C and D, then inspect the sixteen generated subkeys.
  3. Save the trace and compare it with the reference output.

Experimental inputs

Experimental reference · json
{"key":"133457799BBCDFF1"}
Verified baseline reference (check after predicting)
Experimental reference · json
{"subkeys":16,"last":"CB3D8B0E17F5"}

First K=1B02EFFC7072, last K=CB3D8B0E17F5. Parity-only change leaves every subkey identical.

Evidence to record

Round, shift count, C, D, K; compare all sixteen subkeys.

Run baseline →
02

Part D · Controlled investigation

  1. Change the key to 133457799BBCDFF0 (parity only), then 133457799BBCDFF3 (effective bit). Keep all other key bits fixed.
  2. Record the conditions held fixed: all other key bits
  3. Collect Round, shift count, C, D, K; compare all sixteen subkeys. Compare the first differing intermediate step and explain the relationship.
TrialInput configurationPredictionObservedVerification
1{"key":"133457799BBCDFF1"}
2{"key":"133457799BBCDFF0"}

Use the table as a recording template; enter your own measured values in the field below or reproduce it in your report.

Return to simulation →
03

Part E/F · Independent Python verification and deliverables

  1. Download the notebook or toolkit and run the default example.
  2. Reproduce at least one changed input; compare the intermediate values with the browser where supported.
  3. 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.

  1. Run the supplied default values and record the first and final state.
  2. Predict the effect before changing anything. Change last hex digit 1 to 0, then 1 to 3. First verified alternate: {"key": "133457799BBCDFF0"}.
  3. Keep all other key bits.
  4. Measure C,D, shift count and all 16 subkeys.
  5. Restore the baseline and repeat with another valid input. Locate the first differing calculation.
  6. Submit a comparison table, a trace JSON or screenshots of relevant steps, and a short conclusion with an explicit limitation.
TrialChanged inputFixed conditionsPredictionMeasured valueReason / limitation
BaselineNoneDefaultStudent predictionRecord traceExplain
Trial 1Specified changeUnchanged inputsStudent predictionRecord traceExplain

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.

WSL / Linux execution workflow

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).

Optional prerequisites · bash
sudo apt update
sudo apt install -y python3 python3-venv unzip

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 CR05
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.

Step 3 · Run and verify · bash
python lab.py | tee my-results.json
python test_lab.py
python lab.py --params example-input.json
python -m json.tool my-results.json

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 CR05/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.

Verified execution excerpt · text
{
  "first_step": {
    "step": "Round 1",
    "C": "E19955F",
    "D": "AACCF1E",
    "rotation": 1,
    "K": "1B02EFFC7072"
  },
  "result": {
    "subkeys": 16,
    "last": "CB3D8B0E17F5"
  }
}

Test script output:
PASS

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.

Inspect the documented Python implementation
Documented Python implementation · python
# ============================================================
# CR05 | Educational implementation and trace functions
# Copyright © 2026/2027 Dr. Mohammad Alja’afreh
# PSUT IoT Engineering Studio | Educational, synthetic inputs
# ============================================================
def hx(n,w=2): return f'{n:0{w}X}'

# Wrap shifted bits around the fixed word width instead of discarding them.
def rot(x,k,w): return ((x<<k)|(x>>(w-k)))&((1<<w)-1)

def row(label,**values): return {'step':label,**values}

# Standard DES lookup table: PC1
PC1=[57, 49, 41, 33, 25, 17, 9, 1, 58, 50, 42, 34, 26, 18, 10, 2, 59, 51, 43, 35, 27, 19, 11, 3, 60, 52, 44, 36, 63, 55, 47, 39, 31, 23, 15, 7, 62, 54, 46, 38, 30, 22, 14, 6, 61, 53, 45, 37, 29, 21, 13, 5, 28, 20, 12, 4]

# Standard DES lookup table: PC2
PC2=[14, 17, 11, 24, 1, 5, 3, 28, 15, 6, 21, 10, 23, 19, 12, 4, 26, 8, 16, 7, 27, 20, 13, 2, 41, 52, 31, 37, 47, 55, 30, 40, 51, 45, 33, 48, 44, 49, 39, 56, 34, 53, 46, 42, 50, 36, 29, 32]

# Select bits by the standard one-based DES position table.
def perm(x,width,table):
    v=0
    for i in table: v=(v<<1)|((x>>(width-i))&1)
    return v

# Discard parity with PC-1, rotate C/D, select 48-bit subkeys with PC-2.
def deskeys(key):
    cd=perm(key,64,PC1); c,d=cd>>28,cd&0xfffffff; out=[]
    for i,n in enumerate([1,1,2,2,2,2,2,2,1,2,2,2,2,2,2,1]):
        c,d=rot(c,n,28),rot(d,n,28); k=perm((c<<28)|d,56,PC2)
        out.append((c,d,k,n))
    return out

def n(s): return int(s,0)

def b(s): return bytes.fromhex(s)

def exact(s,size):
    v=b(s)
    if len(v)!=size: raise ValueError(f'Expected {size} bytes')
    return v

def pack(result,trace): return {'result':result,'trace':trace}

EXTRA = {}

def run(p):
    k=int.from_bytes(exact(p['key'],8),'big'); t=[row(f'Round {i+1}',C=hx(c,7),D=hx(d,7),rotation=s,K=hx(v,12)) for i,(c,d,v,s) in enumerate(deskeys(k))]
    return pack({'subkeys':len(t),'last':t[-1]['K']},t)

PARAMS = {'key': '133457799BBCDFF1'}
EXPECTED = {'subkeys': 16, 'last': 'CB3D8B0E17F5'}
ALT = {'key': '133457799BBCDFF0'}
ALT_EXPECTED = {'subkeys': 16, 'last': 'CB3D8B0E17F5'}

if __name__ == "__main__":
    import argparse, json
    parser=argparse.ArgumentParser(description="CR05 synthetic cryptography exercise")
    parser.add_argument("--params", help="JSON parameter override file")
    parser.add_argument("--test", action="store_true")
    args=parser.parse_args()
    if args.test:
        assert run(PARAMS)["result"] == EXPECTED
        assert run(ALT)["result"] == ALT_EXPECTED
        print("CR05 default and changed input passed")
    else:
        parameters=PARAMS if not args.params else {**PARAMS,**json.load(open(args.params))}
        print(json.dumps(run(parameters),indent=2))
Verified default result
Reference result · json
{
  "subkeys": 16,
  "last": "CB3D8B0E17F5"
}

05 · Interactive flashcards

Recall before revealing. Review and mastery ratings remain on this device.

Browse all explanations
Why does a parity-only change leave ciphertext unchanged?

PC-1 omits those bit positions.

What is the dependent variable in this lab?

C,D, shift count and all 16 subkeys

What must remain controlled?

all other key bits

What input settings define the baseline for this experiment?

key = 133457799BBCDFF1

What is the first intermediate state in the baseline?

step: Round 1; C: E19955F; D: AACCF1E; rotation: 1; K: 1B02EFFC7072

What check must you reproduce before varying the inputs?

First K=1B02EFFC7072, last K=CB3D8B0E17F5. Parity-only change leaves every subkey identical.

Which observations belong in your experimental record?

Round, shift count, C, D, K; compare all sixteen subkeys.

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

Using key 133457799BBCDFF1, flip the least significant bit of byte 3 and then its second least significant bit. Compare subkey Hamming distances and justify the difference using PC-1. 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.

All Cryptography Engineering labsNext laboratory · CR06 →

How to investigate · CR05

Independent variable: last hex digit 1 to 0, then 1 to 3.

Controlled variables: all other key bits.

Dependent evidence: C,D, shift count and all 16 subkeys.

Weak conclusion: “The output changed.” Stronger reasoning: cite both measured values, name the transformation responsible, and state why the observation does or does not generalize.

Dr. Mohammad · CR05

Offline, deterministic, current-step tutoring. No external AI service or real hardware access.