Skip to main content
PSUT / IoTEngineering learning studio
WORKSPACE
Offline-first portalDr. Mohammad Alja’afreh
Distributed Ledger StudioBlockchain for IoTExperimentsWorkspaces
ENGINEERING WORKSPACE
Home / Kali security course / K09
IoTPSUT IoT Engineering StudioPrincess Sumaya University for Technology · Dr. Mohammad Alja’afreh
WSL LABORATORIES / KALI LINUX / SECURITY & PRIVACY
IoT Security and Privacy

K09 · Privacy-preserving telemetry

Ask Dr. Mohammad · K09 →

Practical IoT Security & Privacy · Kali WSL · 25 min

Design experiment & verify evidence →
K09 · Laboratory mentorAsk about the current experiment, its algorithms or Python notebook.
Ask Dr. MohammadAdaptive practice
Learning workflow · Kali & IoT securityK09 · Privacy-preserving telemetry
V19.0 · Contextual AI workspace

Ask your engineering assistants

K09 · current context

Ask Dr. Mohammad locally, or prepare an experiment-aware prompt for ChatGPT, Gemini or Claude. The external providers open in their own tabs; nothing is automatically submitted.

Dr. Mohammad · offline
Dr. Mohammad

Offline curriculum-grounded assistance.

Open local tutor
K09 · Privacy-preserving telemetry

Public course objective, displayed commands, source excerpts and procedure. Private assessment content is not collected.

Prepare a contextual AI prompt

0 characters

Common secret and email patterns are redacted on preparation; this is not a comprehensive privacy filter. Review the entire editable prompt, including student work and unpublished research, before sharing. The providers apply their own accounts, privacy settings and limits.

Prepare → review → copy & open your selected provider → paste and submit there.

Readiness checksRevision deckEngineering workspaceRecord evidence
K09 · Academic orientation

Scope and objectives

Scope of the experiment

Measure utility loss and field disclosure after minimization.

The focus of this experiment is to identify sensitive telemetry fields and data-minimization requirements. Students then compare transformations against stated utility and privacy needs, and document residual linkage risks without claiming anonymity. 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

  • Identify sensitive telemetry fields and data-minimization requirements.
  • Compare transformations against stated utility and privacy needs.
  • Document residual linkage risks without claiming anonymity.
  • Identify the configured inputs (Fictional device ID; Temperature (°C); Decimal places; Field policy; Demo pseudonym key) and record the corresponding observed outputs with units where applicable.
  • 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 identify sensitive telemetry fields and data-minimization requirements, compare transformations against stated utility and privacy needs, and document residual linkage risks without claiming anonymity.

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 document residual linkage risks without claiming anonymity. Separate predicted values from observations.

Prerequisite knowledge and related learning

Review the following catalogue prerequisites before starting. After completion, continue to K10 · Credential & key protection.

Environment and experimental methodology

The specified isolated laboratory environment, with local synthetic inputs and authorized services only. Use the experiment-specific setup and verification instructions.

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.

CONCEPTS / ACTIVE RECALL

Understand the experiment

Scientific architecture · Privacy telemetry transformation

Telemetry privacy transformation — Original record / device ID, time, location, value; Minimize / remove unnecessary fields; Pseudonymize / replace direct identifier; Release / authorized recipient; Residual risk / linkage remains possible
Scientific concept map: Raw telemetry — Identifier + sensitive values; Data minimization — Remove unnecessary fields; Pseudonym — Replace identifier; Recipient — Permitted view; Risk — Re-identification remains possible.

Scientific foundations and analytical reasoning

Minimization removes unnecessary fields; rounding reduces precision; keyed pseudonyms preserve controlled linkage but are not anonymity.

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 · Privacy and data minimization

Privacy engineering begins with identifying which attributes are needed for the stated purpose. Removing direct identifiers reduces exposure; coarse quantization reduces precision. A deterministic keyed pseudonym can support linkage within its domain but remains personal data when reidentification is possible.

Worked example and engineering interpretation

Rounding temperature 23.46 °C to the nearest degree produces 23 °C. Removing a name while retaining exact location and timestamps may still permit linkage. Compare utility and data exposure under each transformation, and avoid exporting unnecessary identifiers.

Engineering principles · additional worked teaching example

Data minimization removes unnecessary fields; pseudonymization replaces identifiers but may still allow linkage. Rounding 18.76 to one decimal gives18.8, absolute error0.04 °C. Timestamp patterns can reidentify devices despite pseudonyms.

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 K09 · Privacy-preserving telemetry

Minimize and pseudonymize fictional telemetry; explain residual linkage risk.

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: Minimize and pseudonymize fictional telemetry; explain residual linkage risk.

  1. Run minimized with 25.482 °C and one decimal. Confirm output contains only a pseudonymous device and 25.5 °C.
  2. Select raw and compare serialized bytes and five retained fields; identify owner, room and token exposure.
  3. Return to minimized; reduce precision to zero and quantify absolute temperature error.
  4. Change only pseudonym key and compare device labels. Same key enables linkage, changed key alters the label.

Reference check:

Model boundary:

Independent task and submission evidence

2. Select raw and compare serialized bytes and five retained fields; identify owner, room and token exposure. 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.

Worked engineering reasoning and boundary conditions

Engineering reference configuration: Fictional device ID = DEMO-001; Temperature (°C) = 25.482; Decimal places = 1; Field policy = minimized; Demo pseudonym key = privacy-key. In the classroom model, Retained fields = 2; Temperature published = 25.5 °C; Absolute temperature error = 0.018 °C; Published bytes = 48 B. Pseudonymization reduces direct disclosure but does not remove linkage risk. Actual HMAC pseudonym and JSON transform, no differential privacy claim.

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 · quantity comparison

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.

K09 · Privacy-preserving telemetry: quantity comparisonRaw JSON116 BPublished JSON48 B

Step 1 of 2 · Raw JSON

Raw JSON

Raw JSON
116 B

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

Recall the concept before revealing its explanation.

0 / 3 revealed
K09 · 01 / 08What is pseudonymization?Reveal explanation
Engineering explanation

Replacing direct identifiers with keyed aliases; it does not guarantee anonymity.

K09 · 02 / 08What is minimization?Reveal explanation
Engineering explanation

Retaining only fields needed for the stated purpose.

K09 · 03 / 08Which original and pseudonymized records must be distinguished?Reveal explanation
Engineering explanation

Use fictional input only. Compare output fields and precision; do not submit secrets or real personal information.

K09 · 04 / 08Why does pseudonymization not guarantee anonymity?Reveal explanation
Engineering reasoning

Stable pseudonyms may still permit linkage or re-identification with auxiliary data.

K09 · 05 / 08Why minimize telemetry fields before transmission?Reveal explanation
Engineering reasoning

It reduces unnecessary disclosure and limits the information available to recipients or attackers.

K09 · 06 / 08Fictional telemetry is pseudonymized. Select every technically valid statement. A. Minimize fields not needed for the purpose. B. Pseudonyms can still permit linkage. C. A pseudonym always makes a dataset anonymous. D. Retaining all identifiers is data minimization.Reveal explanation
Applied scenario

Correct: A. Minimize fields not needed for the purpose.; B. Pseudonyms can still permit linkage.

K09 · 07 / 08In K09 · Privacy-preserving telemetry, which command or code executes the final documented practical action?Reveal explanation
Implementation recall

cat "$HOME/.psut-kali-security-v14/evidence/K09-PRIVACY.json"

K09 · 08 / 08For K09 · Privacy-preserving telemetry, which actual output or state confirms the prescribed practical run succeeded, and what does it not establish?Reveal explanation
Evidence & acceptance

Run lab.py privacy with fictional records. Verify allowlisted device and temperature only, temperature 25.5, no owner/room/token fields. HMAC pseudonym changes with key; it is not anonymity. Do not submit raw private data.

Loading experiment-specific apparatus…
K09 · Model-linked instrumentation

Visual observation lens

Back to controls ↑

Closed two-condition teaching fixture; actual security validation requires the practical procedure.

Loading instrument…

Awaiting model display.

Experimental instrumentation · A/B

Compare two model conditions

Capture a baseline, change one experimental condition, run the model if required and capture the comparison. Snapshots contain visible controls and display text, not physical sensor readings. Review before exporting.

Open simulation view
Baseline A
Not captured
Comparison B
Not captured

Capture a baseline to begin.

Evidence portfolio →

Experimental protocol

Before you run / verification gate

Use fictional input only. Compare output fields and precision; do not submit secrets or real personal information.

Experimental protocol

Prerequisites
K06; fictional records only
Procedure
Apply allowlist, keyed pseudonym and precision reduction.
Acceptance
Owner, room and token absent; reduced precision verified; pseudonym differs from original.
Evidence
K09-PRIVACY.json plus retention/purpose/utility discussion.
Standards link
Data minimization / privacy
Discussion
Why does pseudonymization not guarantee anonymity?

Run & verify — acceptance checklist

Build verification: Actual data minimization and pseudonymization controls passed.

Run lab.py privacy with fictional records. Verify allowlisted device and temperature only, temperature 25.5, no owner/room/token fields. HMAC pseudonym changes with key; it is not anonymity. Do not submit raw private data.

Record the actual output, source (mock/model or physical), and any error. A missing tool, timeout or untested external service is not a pass.

Complete lab-by-lab verification report →Open automated verification center → Ask Engineering Copilot →

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

Round 25.482 °C to 1 and 0 decimal places. Calculate absolute error for each and list fields that a minimal temperature record requires.

02 · Compare or justify using evidence

Compare stable and rotated pseudonyms; describe how repeated times/locations can still enable linkage without the original identifier.

03 · Design calculation

Design calculation · Independent work

Round 31.486 to two and zero decimals; compute errors and choose a representation for a ±0.1 °C reporting requirement.

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.

Intermediate · Explain a changed-input result

Independent theoretical exercise · K09-01

Use the reference configuration (Fictional device ID = DEMO-001; Temperature (°C) = 25.482; Decimal places = 1; Field policy = minimized; Demo pseudonym key = privacy-key), but change Temperature (°C) = 25.484. The model reports Absolute temperature error = 0.016 °C. Explain the governing rule and assumptions that make this output plausible; identify an independent verification method.

Intermediate · Quantitative comparison

Independent theoretical exercise · K09-02

Two model observations of Absolute temperature error are 0.018 °C (reference) and 0.016 °C (changed condition). Compute signed change and, when the reference is nonzero, percentage change. Explain why units matter.

Intermediate · Interpret a technical trace

Independent theoretical exercise · K09-03

For Decimal places = 3, the model supplies this excerpt from Field-level disclosure: Field · Original · Published device · DEMO-001 · dae193a9d26b6b50 owner · Fictional Person · Removed room · Demo room · Removed temperature · 25.482 · 25.482 token · DEMO-NOT-A-SECRET · Removed Count rows whose Original value is exactly “DEMO-001”, and identify the displayed row numbers. Explain what the count describes.

Advanced · Reverse reasoning

Independent theoretical exercise · K09-04

An observation is Temperature published = 25.482 °C. Candidate A uses Fictional device ID = DEMO-001; Temperature (°C) = 25.482; Decimal places = 1; Field policy = minimized; Demo pseudonym key = privacy-key. Candidate B changes the listed settings (Decimal places = 3) and keeps the remaining settings fixed. Which is consistent with the observation? If both can explain it, say what additional evidence is required.

Advanced · Diagnose a reported mismatch

Independent theoretical exercise · K09-05

A student configures Field policy = raw while preserving all other reference settings, but copies the reference report of Retained fields = 2. Evaluate whether the report is justified. Identify the first configuration/output check to perform.

Challenging · Design a controlled verification

Independent theoretical exercise · K09-06

Design a controlled comparison for K09 · Privacy-preserving telemetry using reference Fictional device ID = DEMO-001; Temperature (°C) = 25.482; Decimal places = 1; Field policy = minimized; Demo pseudonym key = privacy-key and test Temperature (°C) = 25.484. Specify the changed setting(s), measured metric Absolute temperature error, controls, repetitions, an acceptance check and what evidence can distinguish an actual implementation from the model.

Step-by-step experimental procedure

Measure utility loss and field disclosure after minimization.

1 · Reference workbench configuration

Use the named reference workbench and its reference inputs. Additional live instruments may have different controls; use the matching instrument. Record virtual and practical results separately.

Fictional device IDDEMO-001
Temperature (°C)25.482
Decimal places1
Field policyminimized
Demo pseudonym keyprivacy-key

2 · Perform the investigation in order

  1. Run minimized with 25.482 °C and one decimal. Confirm output contains only a pseudonymous device and 25.5 °C.
  2. Select raw and compare serialized bytes and five retained fields; identify owner, room and token exposure.
  3. Return to minimized; reduce precision to zero and quantify absolute temperature error.
  4. Change only pseudonym key and compare device labels. Same key enables linkage, changed key alters the label.
  5. Run lab.py privacy locally and inspect only the fictional minimized record.

3 · Compare controlled trials

TrialIndependent changeExpected checkObservation
MinimizedUse reference inputs aboveRetained fields: 2; Temperature published: 25.5Record actual result
RawField policy = rawRetained fields: 5Record actual result
Lower precisionDecimal places = 0Temperature published: 25Record actual result
New keyDemo pseudonym key = another-keyRetained fields: 2Record actual result

4 · Analyze and report

Explain why pseudonymization is not anonymity and why the key must remain private.

Required evidence: Raw and minimized field tables, size and error comparison.

Model boundary: Actual HMAC pseudonym and JSON transform, no differential privacy claim.

Controlled investigation · reproducible evidence

Method. Use the existing reference workbench configuration and the named controlled changes below. A controlled variable stays fixed while the independent variable is intentionally changed; the dependent variable is the resulting observed output. First predict each trial from the Concepts page. Run the baseline, then change only the specified setting and record the outcome. For deterministic traces one execution per case and a repeated verification are sufficient; for timing or stochastic measurements repeat at least five times, recording each run, median and range. Reset to the reference state between independent comparisons.

TrialIndependent changeDependent observation
MinimizedUse reference inputs aboveRecord actual outcome and units
RawField policy = rawRecord actual outcome and units
Lower precisionDecimal places = 0Record actual outcome and units
New keyDemo pseudonym key = another-keyRecord actual outcome and units

Evidence: attach the completed comparison table, one trace or screenshot per condition, and actual practical terminal/hardware evidence where applicable. Explain any prediction mismatch and distinguish modeled behavior from measured results.

Loading laboratory-specific procedure…

Python / Google Colab notebook

Original defensive function; ephemeral evidence directory. Validated locally in a fresh Jupyter kernel. Download, then upload to Google Colab.

Download NotebookOpen Google ColabAll Python notebooks
K09 / Kali · Python25 min

Privacy-preserving telemetry

Kali terminal C · working directory
Kali (Bash)
cd ~/kali-labs
bash verify_kali.sh
✓ Expected: Toolkit directory is selected and all dependency checks pass. Do not proceed if any check fails.

Objective: Transform a fictional sample using allowlisted fields, keyed pseudonymization and reduced precision.

Compare utility and privacy leakage before/after minimization.

ACTION 01 / 02
Kali terminal C
python3 lab.py privacy
✓ Expected: The JSON report shows minimized fictional telemetry and keyed pseudonymization; raw identifiers and unnecessary fields are excluded.
ACTION 02 / 02
Kali terminal C
cat "$HOME/.psut-kali-security-v14/evidence/K09-PRIVACY.json"
✓ Expected: The saved JSON report prints individual check outcomes. Review pass/fail rather than assuming all tests succeeded.

Experimental notebook

Record your own results. Values are not prefilled or independently verified.

Method and implementation

Review the implementation after attempting the practical steps.

Privacy design · method and source

Use a field allowlist rather than blacklisting known sensitive fields. Keyed pseudonyms permit linkage while the key remains stable; rounding trades utility for precision. Document retention, access and purpose limitation.

Inspect the actual implementation below. Full file: lab.py.

PYTHON · Source code
def privacy():
    raw={'device':'DEMO-001','owner':'Fictional Person','room':'Demo room','temperature':25.482,'token':'DEMO-NOT-A-SECRET'};salt=secrets.token_bytes(32)
    minimized={'device':hmac.digest(salt,raw['device'].encode(),'sha256').hex()[:16],'temperature':round(raw['temperature'],1)}
    return save('K09-PRIVACY',[check('Allowlisted fields only',set(minimized)=={'device','temperature'},json.dumps(minimized)),check('Reduced precision',minimized['temperature']==25.5,'0.1 degree resolution'),check('Pseudonym not raw identifier',minimized['device']!=raw['device'],'Pseudonymization is not anonymity')])

Verification and notebook

Expected observation / verification

Expected output only contains pseudonymous device and rounded temperature. Pseudonymization is not anonymization.

Engineering discussion

Which fields remain necessary for the application? What linkage risk remains?

Python / Google Colab laboratory

K09 · 11 notebook cells · 3 executable Python cells

Complete the theoretical investigation first. Run the cells in order, record actual outputs and compare against your prediction.

How to execute

  1. Download this notebook and open Google Colab. Select File → Upload notebook and choose the downloaded .ipynb.
  2. Read the Markdown instructions before each executable cell. Use a Python runtime, run cells from top to bottom, and resolve imports if necessary.
  3. Perform the baseline and controlled changes. Save the notebook with actual outputs and your written interpretation.

Execution scope: Default computational cells passed isolated local Python execution; physical equipment and live services require separate verification.

01Instructions · Markdown
# K09 · K09 · Privacy-preserving telemetry **PSUT IoT Engineering Studio — Dr. Mohammad Alja’afreh** ## Introduction Minimize and pseudonymize fictional telemetry; explain residual linkage risk. ## How to run 1. Download this notebook from the laboratory page. Open Google Colab → File → Upload notebook. 2. Select a Python CPU runtime. Run cells from top to bottom using Shift+Enter, or Runtime → Run all. 3. Read the printed observations and assertions. Change one parameter at a time and rerun the relevant cell. 4. Save your own outputs and compare them to the portal Experiment tab. **Execution boundary:** Original defensive function; ephemeral evidence directory. Do not run the hardware or service commands in Colab. No real credentials are needed. The notebook is self-contained.
02Instructions · Markdown
## Experiment-specific preparation Minimize and pseudonymize fictional telemetry; explain residual linkage risk. **Reference procedure (use the matching simulator/WSL tool where named, not an unrelated service):** 1. Run minimized with 25.482 °C and one decimal. Confirm output contains only a pseudonymous device and 25.5 °C. 2. Select raw and compare serialized bytes and five retained fields; identify owner, room and token exposure. 3. Return to minimized; reduce precision to zero and quantify absolute temperature error. 4. Change only pseudonym key and compare device labels. Same key enables linkage, changed key alters the label. 5. Run lab.py privacy locally and inspect only the fictional minimized record. **Evidence:** **Boundary:**
03Instructions · Markdown
## 1. Objectives and reference condition - Reproduce the specific computational mechanism in this laboratory. - Inspect the output, compare the reference condition with a changed or rejected condition where implemented, and explain any discrepancy. - Distinguish actual local Python execution from mock, physical and external-service observations. ## 2. Environment check
04Python · executable cell
PYTHON · Code cell
# =====================================================================
# K09 | Code cell 01 | K09 · Privacy-preserving telemetry
# Purpose: 1. Objectives and reference condition - Reproduce the specific computational mechanism in this laboratory. - Inspect the output, compare the reference condition with a changed or rejected condition where implem
# Inputs: the explicit fixture/settings below and any preceding cell state.
# Output: inspect printed values, returned records or assertions; record evidence.
# =====================================================================
import sys
print("Python",sys.version.split()[0])
# Check the expected invariant so a mismatch fails visibly instead of appearing successful.
assert sys.version_info >= (3,10)
Ask Dr. Mohammad about this cell
05Instructions · Markdown
## 3. Implementation Read the comments and variable definitions before execution. Assertions must pass; inspect values, not just completion.
06Python · executable cell
PYTHON · Code cell
# =====================================================================
# K09 | Code cell 02 | K09 · Privacy-preserving telemetry
# Purpose: 3. Implementation Read the comments and variable definitions before execution. Assertions must pass; inspect values, not just completion.
# Inputs: the explicit fixture/settings below and any preceding cell state.
# Output: inspect printed values, returned records or assertions; record evidence.
# =====================================================================
import hmac, json, secrets, time

from pathlib import Path

# Set HOME for the next computation or reference condition.
HOME=Path.home()/'.psut-kali-security-v14'

# Define the reusable operation save; keep its logic separate from the trial.
def save(name, tests):
    report={'schema':'psut-kali-v14','experiment':name,'source':'local-execution-self-reported','utc':time.strftime('%Y-%m-%dT%H:%M:%SZ',time.gmtime()),'checks':tests}
    out=HOME/'evidence'; out.mkdir(parents=True,exist_ok=True,mode=0o700)
    (out/(name+'.json')).write_text(json.dumps(report,indent=2)+'\n')
    print(json.dumps(report,indent=2)); return all(x['pass'] for x in tests)

# Define the reusable operation check; keep its logic separate from the trial.
def check(name, ok, observation): return {'name':name,'pass':bool(ok),'observation':str(observation)}

# Define the reusable operation privacy; keep its logic separate from the trial.
def privacy():
    raw={'device':'DEMO-001','owner':'Fictional Person','room':'Demo room','temperature':25.482,'token':'DEMO-NOT-A-SECRET'};salt=secrets.token_bytes(32)
    minimized={'device':hmac.digest(salt,raw['device'].encode(),'sha256').hex()[:16],'temperature':round(raw['temperature'],1)}
    return save('K09-PRIVACY',[check('Allowlisted fields only',set(minimized)=={'device','temperature'},json.dumps(minimized)),check('Reduced precision',minimized['temperature']==25.5,'0.1 degree resolution'),check('Pseudonym not raw identifier',minimized['device']!=raw['device'],'Pseudonymization is not anonymity')])
Ask Dr. Mohammad about this cell
07Instructions · Markdown
### Step 2 · Run the reference calculation Read the comments and variable definitions before execution. Assertions must pass; inspect values, not just completion.
08Python · executable cell
PYTHON · Code cell
# =====================================================================
# K09 | Code cell 03 | K09 · Privacy-preserving telemetry
# Purpose: Step 2 · Run the reference calculation Read the comments and variable definitions before execution. Assertions must pass; inspect values, not just completion.
# Inputs: the explicit fixture/settings below and any preceding cell state.
# Output: inspect printed values, returned records or assertions; record evidence.
# =====================================================================
import tempfile
# Limit resource lifetime to this block so files, sockets or temporary state are cleaned up.
with tempfile.TemporaryDirectory() as d:
    HOME=Path(d)
    assert privacy()
Ask Dr. Mohammad about this cell
09Instructions · Markdown
## Original portal implementation (reference only) These are the actual laboratory snippets. They are retained for comparison; follow the portal setup for WSL, hardware or services. They are **not** executed by Run all. ```bash python3 lab.py privacy ``` ```python def privacy(): raw={'device':'DEMO-001','owner':'Fictional Person','room':'Demo room','temperature':25.482,'token':'DEMO-NOT-A-SECRET'};salt=secrets.token_bytes(32) minimized={'device':hmac.digest(salt,raw['device'].encode(),'sha256').hex()[:16],'temperature':round(raw['temperature'],1)} return save('K09-PRIVACY',[check('Allowlisted fields only',set(minimized)=={'device','temperature'},json.dumps(minimized)),check('Reduced precision',minimized['temperature']==25.5,'0.1 degree resolution'),check('Pseudonym not raw identifier',minimized['device']!=raw['device'],'Pseudonymization is not anonymity')]) ```
10Instructions · Markdown
## 4. Results and analysis Record the actual output and whether the assertions pass. Identify a parameter to vary, state your prediction, repeat the reference calculation, then explain the changed result. | Trial | Configuration | Observation | Interpretation | |---|---|---|---| | A | Reference | | | | B | One controlled change | | | | C | Reference repeat | | | **Limitations:** Original defensive function; ephemeral evidence directory. Notebook success does not certify external equipment or services.
11Instructions · 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. Select raw and compare serialized bytes and five retained fields; identify owner, room and token exposure. 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.
Shared research workbenches · network designer & advanced studies
Concurrent-device simulation & Monte Carlo research
Distributed digital twin · topology, protocol & battery research