Trace the 320-bit permutation, authenticate an IoT packet and inspect sponge hashing.
The focus of this experiment is to trace lightweight Ascon authenticated encryption and hashing roles. Students then inspect nonce, associated-data and tag verification conditions, and verify supplied vectors and distinguish algorithm families. 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 lightweight Ascon authenticated encryption and hashing roles.
Inspect nonce, associated-data and tag verification conditions.
Verify supplied vectors and distinguish algorithm families.
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 lightweight Ascon authenticated encryption and hashing roles, inspect nonce, associated-data and tag verification conditions, and verify supplied vectors and distinguish algorithm families.
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 supplied vectors and distinguish algorithm families. 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 SIMON — lightweight Feistel block cipher.
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.
Ascon · Advanced analytical foundations
Ascon is a permutation-based construction, not a conventional block cipher. A 320-bit state contains five 64-bit words. In the standardized AEAD128 construction, x0 and x1 are the 128-bit rate; x2–x4 form the 192-bit capacity. Hash256 instead absorbs eight bytes per block into x0. The public permutation is shared, but IVs, padding and finalization differ between constructions.
1 · Historical versus standardized variants
Construction
Rate
Initialization / processing
Output
Historical Ascon-128
64 bits
p12 / p6
128-bit tag
Historical Ascon-128a
128 bits
p12 / p8
128-bit tag
Ascon-AEAD128 (SP 800-232)
128 bits
p12 / p8
128-bit tag
Ascon-Hash256
64 bits
p12 throughout
256-bit digest
Historical Ascon-128 encoded its parameters as IV 80400c0600000000. Standardized AEAD128 uses word 00001000808c0001 and little-endian byte encoding. The variants must not be mixed. The standard also defines Ascon-XOF128 and Ascon-CXOF128; these are extendable-output functions, not encryption. This lab calculates AEAD128, Hash256 and the p6/p8/p12 permutation (p6 is included for historical study).
2 · Bit-sliced S-box and diffusion
For a selected bit position j, collect x0[j] through x4[j] into a 5-bit column (x0 as most significant bit for the displayed lookup index). The nonlinear substitution acts on all 64 columns in parallel. After pC, the bit-sliced circuit first performs x0 ^= x4, x4 ^= x3, x2 ^= x1, then computes five cyclic nonlinear terms t[i] = x[i] XOR ((NOT x[(i+1) mod 5]) AND x[(i+2) mod 5]). Postmix t1 ^= t0, t0 ^= t4, t3 ^= t2, t2 = NOT t2. The linear layer applies x_i XOR ROR(x_i,a_i) XOR ROR(x_i,b_i).
State word
Rotation a
Rotation b
x0
19
28
x1
61
39
x2
1
6
x3
10
17
x4
7
41
3 · Authenticated encryption mechanics
Initialize IV || K || N; apply p12 and XOR the key into x3,x4. For nonempty associated data, append byte 01 and enough zero bytes to reach a 16-byte boundary (including a complete padding block if already aligned), XOR each block into the rate, and apply p8. Empty AD skips absorption, but not domain separation: flip the most significant bit of x4. For each full plaintext block, XOR into the rate, emit the rate as ciphertext and apply p8. Pad and absorb the final partial block (even when empty), emit only the original tail length. XOR the key into x2,x3, apply p12, XOR it into x3,x4 and serialize the tag. The receiver must authenticate before releasing plaintext. AEAD alone does not prevent replay; the application must enforce freshness and nonce uniqueness.
4 · Sponge construction and resource costs
Hash256 initializes a separate IV and applies p12; pads at the eight-byte rate; XORs each block into x0 and applies p12. It serializes four 64-bit rate chunks, with p12 between chunks. Compare the number of permutation calls, absorbed blocks and output bytes, not just wall-clock timings. ASIC area, cycles, clock frequency and energy are platform-specific; a browser runtime is not an MCU or ASIC benchmark.
Five 64-bit words, one vertical 5-bit substitution input, and the constant, substitution and diffusion layers.
Scientific foundations and analytical reasoning
Ascon-AEAD128 uses 320 state bits, 128-bit rate, 192-bit capacity and 12/8-round permutations. Historical Ascon-128 uses different rate and encoding.
Before operating the equipment or executing the program, derive the expected outcome using the required theoretical work in Experiment. Use the diagram to identify the variables and system boundaries.
Scientific theory · Rate, capacity and domain separation
A sponge construction has a rate through which data enters or leaves and a capacity not directly exposed. Ascon uses a 320-bit permutation, with AEAD128 using a 128-bit rate and Hash256 a 64-bit rate. The IV, padding and domain-separation bit distinguish algorithm phases; legacy variants have different encoding and parameters.
Worked example and engineering interpretation
For a 16-byte AEAD message, ciphertext has 16 bytes and the tag adds 16 bytes, with nonce and associated data accounted for separately. An internal padding block is still required at an aligned boundary. Use the advanced permutation and AEAD workstations to verify exact states rather than infer them from output lengths.
Engineering principles · additional worked teaching example
Ascon uses a lightweight permutation-based design. AEAD provides both confidentiality and integrity; nonce and associated data are separate inputs. A tag mismatch requires failure, not returning corrupted plaintext.
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.
How to investigate Ascon — lightweight authenticated encryption and hashing
Trace the 320-bit permutation, authenticate an IoT packet and inspect sponge hashing.
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 the 320-bit permutation, authenticate an IoT packet and inspect sponge hashing.
Parameters, state and historical IV — complete its numbered steps and record the requested evidence.
AEAD four-phase state trace — complete its numbered steps and record the requested evidence.
Permutation microscope — complete its numbered steps and record the requested evidence.
Hash and constrained-device trade-offs — complete its numbered steps and record the requested evidence.
Reference check: Five 64-bit words; 36 transformations plus input.
Tag 4427d64b8e1e1451fc445960f0839bb0.
Intact accepted; altered inputs rejected.
Empty digest 0b3be5850f2f6b98caf29f8fdea89b64a1fa70aa249b8f839bd53baa304d92b2.
Model boundary: The supplied lecture discusses original Ascon-128 (64-bit rate, p6) and Ascon-128a (128-bit rate, p8). The executable lab follows final NIST SP 800-232 Ascon-AEAD128: 128-bit rate, 192-bit capacity, little-endian encoding, p12/p8 and a 128-bit tag. Ascon-Hash256 uses a 64-bit rate and p12. Earlier vectors and IVs are not interchangeable. The Wi-Fi application in the lecture is an exploration, not a claim that current Wi-Fi uses Ascon.
Independent task and submission evidence
2. AEAD four-phase state trace — 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.
Trial
Changed setting
Fixed settings
Predicted result
Actual observation / units
Evidence / uncertainty
A: baseline
Reference
Record
Predict
Record
Record
B: one change
Record
Same as A
Predict
Record
Record
A: repeat
Restore
Same as A
Predict
Record
Record
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.
Constrained-device cryptography
Ascon was selected by NIST for lightweight cryptography and provides authenticated encryption and hashing based on a 320-bit permutation. Standardized Ascon-AEAD128 uses a 128-bit key, 128-bit nonce, 128-bit rate, 192-bit capacity, p12 and p8, with a 128-bit authentication tag. Historical Ascon-128 uses a 64-bit rate and p6; Ascon-128a uses a 128-bit rate and p8. Do not mix legacy encoding or IV values with the standardized construction.
Five-word permutation
The state consists of x0…x4, each 64 bits. Each round adds a constant to x2, applies 64 parallel five-bit nonlinear substitutions and diffuses each word using XOR with two rotated copies. The standardized bit/byte ordering is little-endian. The permutation itself is unkeyed; the AEAD construction controls key injection and domain separation.
AEAD and hashing
Load IV, key and nonce, permute and inject key; absorb associated data and separate domains; absorb plaintext while producing ciphertext; finalize with the key and tag. Associated data remains visible but is authenticated. The receiver must verify the tag before releasing plaintext. Ascon-Hash256 absorbs input with a 64-bit rate and squeezes four 64-bit output words. Its unkeyed digest does not identify the sender.
Measurement and trade-offs
Compare throughput, area, energy and latency under the same hardware and software conditions. A small bitwise implementation does not automatically resist power analysis; implementation countermeasures and tests are still required. Use unique nonces for every key and apply replay policy separately from authentication.
Prerequisites: EC08 or EC10
Algorithm structure and data flow. Use the simulation to inspect the corresponding numerical transformations.
Historical and standardized AEAD configurations
Variant
Rate (bits)
Capacity (bits)
Initial/final rounds
Intermediate rounds
Ascon-128
64
256
12
6
Ascon-128a
128
192
12
8
Ascon-AEAD128
128
192
12
8
Permutation round constants
p12 round
p8 round
p6 round
XOR constant for x2
0
—
—
0xF0
1
—
—
0xE1
2
—
—
0xD2
3
—
—
0xC3
4
0
—
0xB4
5
1
—
0xA5
6
2
0
0x96
7
3
1
0x87
8
4
2
0x78
9
5
3
0x69
10
6
4
0x5A
11
7
5
0x4B
Linear diffusion distances
Word
First rotation right
Second rotation right
x0
19
28
x1
61
39
x2
1
6
x3
10
17
x4
7
41
State encoding, padding and diffusion
For the historical Ascon-128 construction, the IV is 80400c0600000000 in big-endian word notation. In the standardized AEAD construction the little-endian IV word is 00001000808c0001. Initialization loads x0=IV, x1=K0, x2=K1, x3=N0 and x4=N1, then p12 and key injection into x3 and x4. Nonempty associated data is padded and processed in rate-sized blocks; the standardized separator flips bit 63 of x4 even for empty AAD. After full message blocks use p8; pad the final partial or empty block without emitting padding bytes. Finalization XORs the key into x2 and x3, applies p12, then XORs the key into x3 and x4 to form the tag.
Bit-sliced substitution operates vertically across the five words. Word diffusion operates horizontally using x XOR RORa(x) XOR RORb(x). The rotation pairs are (19,28), (61,39), (1,6), (10,17), (7,41). Round constants in p12 are f0 e1 d2 c3 b4 a5 96 87 78 69 5a 4b. The shorter permutations select the final constants.
Hashing and implementation trade-offs
Ascon-Hash256 begins with the standardized IV word 0000080100cc0002 and four zero words, uses a 64-bit absorption rate and p12. Absorb the padded input, then read four 64-bit words with p12 between outputs. A 128-bit PUF response occupies two complete input blocks plus the required padding block. Its unkeyed digest is not authentication. The common permutation is useful for constrained hardware; the bit-sliced implementation avoids table lookups, but does not automatically eliminate timing, power or fault leakage. Hardware serialization and parallel rounds trade area for latency. Benchmark comparable implementations on the same platform.
Engineering diagrams
Ascon round: vertical substitution and horizontal diffusion.
Standardized AEAD: initialization, associated data, message and tag.
Absorb all padded message blocks, then squeeze four output words.
Worked engineering reasoning and boundary conditions
Ascon-AEAD128 uses a 320-bit permutation state, with a 128-bit key and nonce and 128-bit tag in the standardized AEAD. Associated data is authenticated, not encrypted; nonce uniqueness is essential.
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.
Step 1 of 4 · Initialize
Initialize
Initialize
320-bit Ascon state
Absorb
Initialize
320-bit Ascon state
Absorb
associated data
Encrypt
Initialize
320-bit Ascon state
Absorb
associated data
Encrypt
plaintext and permutation
Finalize
Initialize
320-bit Ascon state
Absorb
associated data
Encrypt
plaintext and permutation
Finalize
128-bit authentication tag; reject invalid
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 explanationsWhat is Ascon state width?
320 bits, five 64-bit words.
What rate does standardized AEAD128 use?
128 bits.
What are p12 and p8?
Permutations with 12 and 8 rounds.
What happens to altered associated data?
Authentication fails.
What is the standardized AEAD variant called?
Ascon-AEAD128.
What are the historical Ascon-128 rate and intermediate rounds?
64 bits and p6.
What is the standardized AEAD capacity?
192 bits.
Where is the round constant injected?
Into state word x2.
What does pS do?
Applies a parallel nonlinear five-bit substitution.
What does pL do?
Diffuses each word using XOR with rotated versions of itself.
What are the four AEAD phases?
Initialization, associated data, plaintext/ciphertext processing and finalization.
Why keep the nonce unique under a key?
Nonce reuse violates the AEAD security requirements.
What does associated data permit?
Authentication of readable metadata without encrypting it.
What should a changed tag cause?
Rejection before releasing plaintext.
Which state words form the standardized Ascon-AEAD128 rate?
x0 and x1 (128 bits); x2, x3 and x4 form the 192-bit capacity.
What are the p12 round constants in order?
f0, e1, d2, c3, b4, a5, 96, 87, 78, 69, 5a, 4b. p8 and p6 take the final 8 and 6 respectively.
Only bit 0 of x0 is set. Which bits are set after its diffusion function?
Bits 0, 36 and 45, due to XOR with ROR19 and ROR28. This is not a full round.
AAD is empty. Is domain separation skipped?
No. Skip AAD block absorption, but perform the domain separation before processing the message.
Can an authenticated packet be replayed successfully if the tag is valid?
Authentication alone does not prevent replay. Enforce an independent freshness rule.
Why can Ascon-128a process more data per permutation than Ascon-128?
Its rate is 128 rather than 64 bits, although it uses eight rather than six intermediate rounds. A performance claim must still be measured.
Virtual laboratory
Change inputs independently, play or step through the calculated states, expand a workstation, and compare your observations. Browser network models do not send or capture real packets.
Record mathematical predictions before opening the simulator. Keep all inputs public classroom values and use unique nonces for real keys. The fixed key and nonce fixtures are for reproducible known-answer calculations only.
Activity 1 · Nonlinearity and diffusion
Write five zero 64-bit words. Select p12 and bit 0. Predict the state after XOR of round constant F0 into x2.
Calculate the selected five-bit S-box column by the Boolean equations in Concepts; repeat at bit 4. Show each intermediate XOR, NOT and AND.
For input x0 = 0000000000000001, derive its diffusion result from the two rotations. Inspect the simulator's pL stage for the actual pre-diffusion word and calculate that result independently.
Flip exactly one input bit in x0. Record differential Hamming distances after each round for p6, p8 and p12. Compare diffusion behavior; a single input pair is not a security proof.
Activity 2 · AEAD block boundaries and verification
Use public key and nonce 000102030405060708090a0b0c0d0e0f. Begin with empty message and empty associated data; predict padding and tag length.
Run the AEAD pipeline and inspect initialization, domain separation, final padded block, finalization and receiver verification. Record the tag and compare with the empty-message known-answer vector in the practical code.
Use ASCII messages of lengths 15, 16, 17 and 32 bytes. For each, calculate full blocks, final tail, internal padding bytes, emitted ciphertext and total message-plus-tag overhead. Vary only one input at a time in each controlled reference comparison.
Repeat with empty and 16-byte associated data. Inspect its additional padding block and p8 operations. Explain why ciphertext does not contain AD.
Perform the baseline with no receiver alteration. Then alter one ciphertext bit, tag bit, nonce bit, key bit or the associated data independently. Record sender tag, received tag, computed receiver tag and acceptance. Confirm plaintext is not released after rejection.
Activity 3 · Hash256 sponge
Calculate the number of padded eight-byte blocks for 0, 7, 8, 9 and 16 ASCII input bytes. Predict the padding hex sequence.
Use the Hash256 workstation. Step through initialization, all absorption operations and the four output squeezes. Concatenate the four 64-bit little-endian output chunks and verify the 256-bit digest.
Modify one byte and compare digests. Count differing bits independently; do not treat a single pair as a collision-security result.
Export each trace and cross-check AEAD with the provided Python implementation, and Hash256 with the existing browser reference engine. Record exact inputs, stage values, expected and observed outputs, discrepancies and limitations.
Independent theoretical exercises
Before the simulation or practical, solve both experiment-specific tasks. List the given inputs, show the intermediate calculation or state trace, identify the expected observation, and state a limitation. Show formulas and intermediate calculations where relevant, or draw the requested state/sequence diagram. These are independent classroom fixtures; where they differ from the reference configuration below, do not treat them as measured values. Compare your predictions with the corresponding experiment afterwards.
01 · Predict and derive using the given inputs
Calculate full and partial message blocks for 0,16,17 and 32 byte plaintexts at rate16 bytes; include required final padding. Calculate tag overhead.
Engineering method — Ascon uses a lightweight permutation-based design. AEAD provides both confidentiality and integrity; nonce and associated data are separate inputs. A tag mismatch requires failure, not returning corrupted plaintext. Apply this method to the assigned values independently; compare your reasoning with the relevant simulator or practical implementation.
02 · Compare or justify using evidence
Write the five diffusion rotations from Concepts and trace one single-bit word through its diffusion formula. Explain AD authentication and nonce uniqueness.
Engineering method — Ascon uses a lightweight permutation-based design. AEAD provides both confidentiality and integrity; nonce and associated data are separate inputs. A tag mismatch requires failure, not returning corrupted plaintext. Apply this method to the assigned values independently; compare your reasoning with the relevant simulator or practical implementation.
03 · Design calculation
Design calculation · Independent work
For 18 B plaintext and 16 B tag plus explicit 16 B nonce, derive envelope length and compare with original. Which fields may be public?
Design calculation — Ascon uses a lightweight permutation-based design. AEAD provides both confidentiality and integrity; nonce and associated data are separate inputs. A tag mismatch requires failure, not returning corrupted plaintext. Apply this method to the assigned values independently; compare your reasoning with the relevant simulator or practical implementation.
Work is saved locally when browser storage is available. Export it for submission; no remote upload or automatic grade is assigned.
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.
Foundational · Apply the principle
Independent theoretical exercise · LC01-01
Count transmitted overhead for 20-byte plaintext and separate 16-byte nonce/tag, excluding metadata.
Intermediate · Calculate or trace
Independent theoretical exercise · LC01-02
A public device ID is included as AAD. What service does it receive?
Intermediate · Interpret the result
Independent theoretical exercise · LC01-03
A tag check fails. What is the appropriate application decision?
Advanced · Analyze a condition
Independent theoretical exercise · LC01-04
Compare a 128-bit tag with a 64-bit tag for random guessing under ideal conditions.
Advanced · Diagnose or compare
Independent theoretical exercise · LC01-05
Why should comparison with AES-GCM hold payload and platform fixed?
Challenging · Engineering verification
Independent theoretical exercise · LC01-06
Outline a verification experiment.
Activity sequence
Follow the setup commands, then each named activity. The detailed instructions, given values and recording fields appear below.
Compare observations with the reference checks and submit the required evidence.
Scientific experimental protocol
Research question: Trace the 320-bit permutation, authenticate an IoT packet and inspect sponge hashing.
Independent variables: input message or block, key / associated data, selected bit or permutation rounds. Dependent observations: intermediate words, ciphertext, digest, tag and acceptance.
Controls: use the indicated baseline settings, vary one parameter at a time, and record actual results separately from the browser model. For timing comparisons use the same environment and report repetitions.
2. Follow these commands in sequence (Linux/WSL). For browser-only activities, open Simulation first; the code activities are independent.
BASH · Command
python3 ascon_demo.py
3. Run the check before changing inputs. Record the exact Python version and any dependency error. Use Python visualizer to inspect the recorded traces; for edited code, generate and import a new trace using the instructions in that tab.
Complete the activities in order. Hold the controlled conditions fixed, record the input and actual output, and compare your observations with an independent calculation or test vector.
01
Parameters, state and historical IV
Open the exact workstation
Choose the relevant tab below, enter the assigned values in the activity steps, then use Step or Play to inspect intermediate calculations. Return to Experiment and record the results before changing the input.
Compare historical Ascon-128 (r=64,p6), Ascon-128a (r=128,p8) and standardized Ascon-AEAD128; record key, nonce, state and capacity.
Construct historical IV from 80 40 0c 06 and four zero bytes → 80400c0600000000. Do not load this legacy IV into the standardized engine.
In standardized workstation inspect five words at initialization and the p12/key-injection stages. Use a new nonce for each actual encryption.
Evidence to record
Parameter table and annotated initial state.
Verification: Record the baseline and modified input separately, note the observed intermediate values, compare with the assigned calculation, and explain any mismatch. Do not replace observations with expected values.
02
AEAD four-phase state trace
Open the exact workstation
Choose the relevant tab below, enter the assigned values in the activity steps, then use Step or Play to inspect intermediate calculations. Return to Experiment and record the results before changing the input.
Enter fictional temperature plaintext and device ID/sequence AAD. Step initialization, associated-data absorption/padding, domain separation, plaintext processing, finalization and tag.
Repeat with empty AAD, then lengths 15,16,17 bytes. Record the standardized 128-bit rate; distinguish from historical 64-bit examples.
Keep original sender record fixed and alter only receiver AAD, nonce, ciphertext or tag in separate trials. Require rejection before plaintext release.
Trace both sender and receiver. In the receiver, recover plaintext by XOR with the rate and replace received ciphertext bytes in the state; apply the final-block padding at the same position. Compare the recomputed tag with the received tag before releasing plaintext. Repeat with empty and exact-rate associated data.
Evidence to record
State words, ciphertext, tag and accept/reject table.
Verification: Record the baseline and modified input separately, note the observed intermediate values, compare with the assigned calculation, and explain any mismatch. Do not replace observations with expected values.
03
Permutation microscope
Open the exact workstation
Choose the relevant tab below, enter the assigned values in the activity steps, then use Step or Play to inspect intermediate calculations. Return to Experiment and record the results before changing the input.
Set x0…x4 to known input words. Select p12 and inspect pC round constant in x2, pS parallel five-bit substitutions and pL word rotations.
Repeat p6 and p8; compare calculated states. Manually verify one diffusion operation using the rotation distances below, then flip one input bit and compare differences.
Perform this controlled diffusion test: with only bit 0 of x0 set, isolate x0 XOR ROR19(x0) XOR ROR28(x0); verify bits 0,45,36. Distinguish this step from a full round.
Verification: Record the baseline and modified input separately, note the observed intermediate values, compare with the assigned calculation, and explain any mismatch. Do not replace observations with expected values.
04
Hash and constrained-device trade-offs
Open the exact workstation
Choose the relevant tab below, enter the assigned values in the activity steps, then use Step or Play to inspect intermediate calculations. Return to Experiment and record the results before changing the input.
Use Hash256 workstation to absorb a short message and inspect four 64-bit output blocks; vary one character and compare digest. Note that standardized IV/bit order differ from historical hash example.
Calculate efficiency ratios using the comparative ASIC dataset below. These values do not measure your computer. Compare available local Python timings only under same conditions.
Explain why an unkeyed digest alone cannot authenticate a sender.
Experimental inputs and checks
Comparative ASIC dataset · throughput / area index
Ascon-128a: 25.60 / 1.49; Ascon-128: 16.00 / 1.56; AES-GCM: 11.63 / 2.75. These are normalized comparison values, not measurements from this lab. Calculate the three ratios and discuss the implementation-dependent limitations.
Evidence to record
Digest and rate/capacity comparison, benchmark calculation with consistent units.
Verification: Record the baseline and modified input separately, note the observed intermediate values, compare with the assigned calculation, and explain any mismatch. Do not replace observations with expected values.
05
Wi-Fi associated data application
Open the exact workstation
Choose the relevant tab below, enter the assigned values in the activity steps, then use Step or Play to inspect intermediate calculations. Return to Experiment and record the results before changing the input.
Draw sender → header/AAD construction → AEAD → receiver tag/replay validation using a fictional frame; keep routing header visible.
Change header while holding ciphertext/tag fixed and inspect rejection in workstation. Discuss sequence number replay policy separately from tag verification; this application is a conceptual design, not a deployed Wi-Fi standard.
Evidence to record
Annotated frame and negative-control results.
Verification: Record the baseline and modified input separately, note the observed intermediate values, compare with the assigned calculation, and explain any mismatch. Do not replace observations with expected values.
Trial
Procedure
Reference check
Your observation
Permutation
Set x0 to zero then one; use p12. Inspect each constant/substitution/diffusion state.
Five 64-bit words; 36 transformations plus input.
Enter result
AEAD
Clear message and AAD; keep receiver alteration none; play to final stage.
Tag 4427d64b8e1e1451fc445960f0839bb0.
Enter result
Boundaries
Use ASCII lengths 15, 16 and 17; vary AAD and then change only receiver tag/AAD.
Download this notebook and open Google Colab. Select File → Upload notebook and choose the downloaded .ipynb.
Read the Markdown instructions before each executable cell. Use a Python runtime, run cells from top to bottom, and resolve imports if necessary.
Perform the baseline and controlled changes. Save the notebook with actual outputs and your written interpretation.
Execution scope: The supplied lecture discusses original Ascon-128 (64-bit rate, p6) and Ascon-128a (128-bit rate, p8). The executable lab follows final NIST SP 800-232 Ascon-AEAD128: 128-bit rate, 192-bit capacity, little-endian encoding, p12/p8 and a 128-bit tag. Ascon-Hash256 uses a 64-bit rate and p12. Earlier vectors and IVs are not interchangeable. The Wi-Fi application in the lecture is an exploration, not a claim that current Wi-Fi uses Ascon. Default computational cells passed isolated local Python execution; physical equipment and live services require separate verification.
01Instructions · Markdown
# LC01 · Ascon — lightweight authenticated encryption and hashing
**PSUT IoT Engineering Studio — Dr. Mohammad Alja’afreh**
## 1. Scientific objective
Follow the setup commands, then each named activity. The detailed instructions, given values and recording fields appear below.
Complete the analytical worksheet in the portal first. Record your predictions before running this notebook. This notebook is a bounded local computational investigation; use the portal’s separate WSL, hardware or Remix procedure for real interfaces.
02Instructions · Markdown
## Experiment-specific preparation
Trace the 320-bit permutation, authenticate an IoT packet and inspect sponge hashing.
**Reference procedure (use the matching simulator/WSL tool where named, not an unrelated service):**
1. Parameters, state and historical IV — complete its numbered steps and record the requested evidence.
2. AEAD four-phase state trace — complete its numbered steps and record the requested evidence.
3. Permutation microscope — complete its numbered steps and record the requested evidence.
4. Hash and constrained-device trade-offs — complete its numbered steps and record the requested evidence.
5. Wi-Fi associated data application — complete its numbered steps and record the requested evidence.
**Evidence:** Five 64-bit words; 36 transformations plus input.
Tag 4427d64b8e1e1451fc445960f0839bb0.
Intact accepted; altered inputs rejected.
Empty digest 0b3be5850f2f6b98caf29f8fdea89b64a1fa70aa249b8f839bd53baa304d92b2.
**Boundary:** The supplied lecture discusses original Ascon-128 (64-bit rate, p6) and Ascon-128a (128-bit rate, p8). The executable lab follows final NIST SP 800-232 Ascon-AEAD128: 128-bit rate, 192-bit capacity, little-endian encoding, p12/p8 and a 128-bit tag. Ascon-Hash256 uses a 64-bit rate and p12. Earlier vectors and IVs are not interchangeable. The Wi-Fi application in the lecture is an exploration, not a claim that current Wi-Fi uses Ascon.
03Instructions · Markdown
## 2. Reference configuration and investigation
1. Parameters, state and historical IV — complete its numbered steps and record the requested evidence.
2. AEAD four-phase state trace — complete its numbered steps and record the requested evidence.
3. Permutation microscope — complete its numbered steps and record the requested evidence.
4. Hash and constrained-device trade-offs — complete its numbered steps and record the requested evidence.
5. Wi-Fi associated data application — complete its numbered steps and record the requested evidence.
6. Compare observations with the reference checks and submit the required evidence.
Run cells in order; do not substitute model results for physical measurements.
04Instructions · Markdown
## 3. Actual cipher implementation
Use the public teaching vector. This implementation is not hardened for production.
05Instructions · Markdown
### Implementation cell 1
06Python · executable cell
PYTHON · Code cell
# =====================================================================
# LC01 | Code cell 01 | Ascon — lightweight authenticated encryption and hashing
# Purpose: Implementation cell 1
# Inputs: the explicit fixture/settings below and any preceding cell state.
# Output: inspect printed values, returned records or assertions; record evidence.
# =====================================================================
"""Byte-oriented educational Ascon-AEAD128, NIST SP 800-232 (2025).
Not hardened or validated for production. No secret inputs or external services.
"""
import hmac, json, os
# Set MASK for the next computation or reference condition.
MASK=(1<<64)-1
# Set IV for the next computation or reference condition.
IV=0x00001000808c0001
# Set RC for the next computation or reference condition.
RC=(0xf0,0xe1,0xd2,0xc3,0xb4,0xa5,0x96,0x87,0x78,0x69,0x5a,0x4b)
# Define the reusable operation rot; keep its logic separate from the trial.
def rot(x,n): return ((x>>n)|(x<<(64-n)))&MASK
# =====================================================================
# LC01 | Code cell 02 | Ascon — lightweight authenticated encryption and hashing
# Purpose: Implementation cell 2
# Inputs: the explicit fixture/settings below and any preceding cell state.
# Output: inspect printed values, returned records or assertions; record evidence.
# =====================================================================
# Define the reusable operation perm; keep its logic separate from the trial.
def perm(s,rounds):
for c in RC[-rounds:]:
a,b,d,e,f=s; d^=c
a^=f; f^=e; d^=b
t=[a,b,d,e,f]; u=[t[i]^((~t[(i+1)%5])&t[(i+2)%5]) for i in range(5)]
u[1]^=u[0]; u[0]^=u[4]; u[3]^=u[2]; u[2]=(~u[2])&MASK
s[:]=[x^rot(x,i)^rot(x,j) for x,(i,j) in zip(u,[(19,28),(61,39),(1,6),(10,17),(7,41)])]
# Define the reusable operation word; keep its logic separate from the trial.
def word(b): return int.from_bytes(b,'little')
# Define the reusable operation rate; keep its logic separate from the trial.
def rate(s): return s[0].to_bytes(8,'little')+s[1].to_bytes(8,'little')
# =====================================================================
# LC01 | Code cell 03 | Ascon — lightweight authenticated encryption and hashing
# Purpose: Implementation cell 3
# Inputs: the explicit fixture/settings below and any preceding cell state.
# Output: inspect printed values, returned records or assertions; record evidence.
# =====================================================================
# Define the reusable operation setrate; keep its logic separate from the trial.
def setrate(s,b): s[0],s[1]=word(b[:8]),word(b[8:])
# Define the reusable operation xor; keep its logic separate from the trial.
def xor(a,b):return bytes(x^y for x,y in zip(a,b))
# Define the reusable operation init; keep its logic separate from the trial.
def init(key,nonce,ad):
if len(key)!=16 or len(nonce)!=16:raise ValueError('128-bit key and nonce required')
k0,k1=word(key[:8]),word(key[8:]);s=[IV,k0,k1,word(nonce[:8]),word(nonce[8:])];perm(s,12);s[3]^=k0;s[4]^=k1
if ad:
padded=ad+b'\x01'+b'\0'*((15-len(ad))%16)
for i in range(0,len(padded),16):setrate(s,xor(rate(s),padded[i:i+16]));perm(s,8)
s[4]^=1<<63
return s,k0,k1
# =====================================================================
# LC01 | Code cell 04 | Ascon — lightweight authenticated encryption and hashing
# Purpose: Implementation cell 4
# Inputs: the explicit fixture/settings below and any preceding cell state.
# Output: inspect printed values, returned records or assertions; record evidence.
# =====================================================================
# Define the reusable operation finish; keep its logic separate from the trial.
def finish(s,k0,k1):
s[2]^=k0;s[3]^=k1;perm(s,12);s[3]^=k0;s[4]^=k1
return s[3].to_bytes(8,'little')+s[4].to_bytes(8,'little')
# Define the reusable operation encrypt; keep its logic separate from the trial.
def encrypt(key,nonce,ad,plain):
s,k0,k1=init(key,nonce,ad);out=bytearray()
for i in range(0,len(plain)//16*16,16):
setrate(s,xor(rate(s),plain[i:i+16]));out.extend(rate(s));perm(s,8)
tail=plain[len(plain)//16*16:];setrate(s,xor(rate(s),tail+b'\x01'+b'\0'*(15-len(tail))));out.extend(rate(s)[:len(tail)])
return bytes(out)+finish(s,k0,k1)
# Define the reusable operation decrypt; keep its logic separate from the trial.
def decrypt(key,nonce,ad,combined):
if len(combined)<16:raise ValueError('Missing tag')
c,tag=combined[:-16],combined[-16:];s,k0,k1=init(key,nonce,ad);out=bytearray()
for i in range(0,len(c)//16*16,16):
block=c[i:i+16];out.extend(xor(rate(s),block));setrate(s,block);perm(s,8)
tail=c[len(c)//16*16:];r=rate(s);out.extend(xor(r,tail));new=bytearray(tail+r[len(tail):]);new[len(tail)]^=1;setrate(s,new)
if not hmac.compare_digest(tag,finish(s,k0,k1)):raise ValueError('Authentication failed')
return bytes(out)
# =====================================================================
# LC01 | Code cell 05 | Ascon — lightweight authenticated encryption and hashing
# Purpose: Implementation cell 5
# Inputs: the explicit fixture/settings below and any preceding cell state.
# Output: inspect printed values, returned records or assertions; record evidence.
# =====================================================================
# Define the reusable operation checks; keep its logic separate from the trial.
def checks():
# Independent RustCrypto ascon-aead 0.6.0 test vector Count=1 (SP 800-232).
# https://docs.rs/crate/ascon-aead/0.6.0/source/tests/data/ascon128.txt
k=bytes(range(16));n=k;expected=bytes.fromhex('4427D64B8E1E1451FC445960F0839BB0');actual=encrypt(k,n,b'',b'')
results=[{'control':'independent empty-message KAT','pass':actual==expected,'actual':actual.hex(),'expected':expected.hex()}]
for count,ml,al,hexout in [(2,0,1,'103AB79D913A0321287715A979BB8585'),(33,0,32,'22133A313FBF0B38029A45870AADC542'),(34,1,0,'E79F58F1F541FC51B5D438F8E1DD03F147'),(35,1,1,'25EB4B700ED4AC8517DCBA20F673292230'),(53,1,19,'64E8A535661ECD9BD9986CEA0A46A8556B')]:
expected=bytes.fromhex(hexout);pt=bytes(range(ml));ad=bytes(range(al));actual=encrypt(k,n,ad,pt)
results.append({'control':f'independent KAT {count}','pass':actual==expected and decrypt(k,n,ad,expected)==pt,'actual':actual.hex(),'expected':expected.hex()})
# Fresh key per run, unique nonce for every encryption. Vectors use fixed public inputs only.
k=os.urandom(16)
for size in [0,1,15,16,17,31,32,33,128]:
for alen in [0,1,16,17]:
nonce=(size*100+alen).to_bytes(16,'little');msg=bytes(range(size));ad=b'A'*alen;ct=encrypt(k,nonce,ad,msg)
results.append({'control':f'roundtrip-{size}-{alen}','pass':decrypt(k,nonce,ad,ct)==msg})
for label,nn,aa,cc in [('tag',nonce,ad,ct[:-1]+bytes([ct[-1]^1])),('associated-data',nonce,ad+b'!',ct),('nonce',bytes([nonce[0]^1])+nonce[1:],ad,ct)]+([('ciphertext',nonce,ad,bytes([ct[0]^1])+ct[1:])] if size else []):
try:decrypt(k,nn,aa,cc);ok=False
except ValueError:ok=True
results.append({'control':f'reject-{label}-{size}-{alen}','pass':ok})
return {'schema':'psut-security-evidence-157','experiment':'K15','source':'actual-local-educational-crypto','implementation':'byte-oriented teaching implementation; not production hardened','checks':results,'pass':all(x['pass'] for x in results)}
# =====================================================================
# LC01 | Code cell 06 | Ascon — lightweight authenticated encryption and hashing
# Purpose: 4. Reference encryption and inverse check
# Inputs: the explicit fixture/settings below and any preceding cell state.
# Output: inspect printed values, returned records or assertions; record evidence.
# =====================================================================
# Prepare key; retain only the scope required for this trial.
key=bytes(range(16));nonce=key
# Set ad for the next computation or reference condition.
ad=b'device-01';message=b'temperature=25'
# Set ct for the next computation or reference condition.
ct=encrypt(key,nonce,ad,message)
# Check the expected invariant so a mismatch fails visibly instead of appearing successful.
assert decrypt(key,nonce,ad,ct)==message
print(ct.hex())
try:
decrypt(key,nonce,ad+b'!',ct)
except ValueError:
print('Altered AAD rejected')
else:
raise AssertionError('Authentication failed to reject')
## Experimental analysis and submission
1. Record the reference input, predicted output and actual result.
2. Modify one independent variable and run the relevant cells again.
3. Explain the result using the theory and identify model limitations.
4. Save the notebook with outputs and retain the separate theoretical worksheet.
**Your derivation and conclusion:**
(Complete independently.)
20Instructions · Markdown
## Guided reasoning and evidence
A controlled comparison changes one independent input while keeping the other relevant inputs fixed; the dependent variable is the recorded output. Use this lab’s reference condition above.
**Independent task:** 2. AEAD four-phase state trace — 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.
| Trial | Input/configuration | Prediction | Observation | Evidence / limitation |
|---|---|---|---|---|
| A | Reference | | | |
| B | Changed input | | | |
| A repeat | Reference | | | |
A conclusion is supported only when it cites the recorded values or observed states and explains them with the experiment theory.
Runnable Python implementation
Public teaching inputs only; not production-hardened. Python standard library is sufficient.
Inspect code, local variables, stack and output. Import a newly generated trace after editing the local program. No arbitrary Python executes in the browser.