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.
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.
Distinguish unkeyed digest comparison from authenticated integrity.
The focus of this experiment is to distinguish unkeyed hashes from HMAC authentication. Students then compute and compare tags for original and changed telemetry, and verify rejection and identify freshness as an independent check. 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
Distinguish unkeyed hashes from HMAC authentication.
Compute and compare tags for original and changed telemetry.
Verify rejection and identify freshness as an independent check.
Identify the configured inputs (Sender JSON; Receiver JSON; Sender demo key; Verifier demo 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 distinguish unkeyed hashes from HMAC authentication, compute and compare tags for original and changed telemetry, and verify rejection and identify freshness as an independent check.
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 rejection and identify freshness as an independent check. Separate predicted values from observations.
Prerequisite knowledge and related learning
Review the following catalogue prerequisites before starting. After completion, continue to K07 · Authenticated freshness & replay protection.
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
Telemetry integrity · Hash versus HMAC
An unkeyed digest detects accidental differences only when the expected digest is trusted
Scientific architecture · SHA-256 and HMAC byte integrity
Scientific concept map: Telemetry bytes — UTF-8 encoding; SHA-256 — Unkeyed digest; HMAC — Keyed inner/outer hashes; Received bytes — Original or altered; Verification — Compare tag.
Scientific foundations and analytical reasoning
A cryptographic hash is unkeyed; HMAC binds a message to a shared key through inner and outer hash operations. Exact encoded bytes matter.
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 · Hash and keyed authentication
A hash maps arbitrary input to a fixed-length digest without a secret. HMAC normalizes the key to the hash block size and computes H((K′ XOR opad) ∥ H((K′ XOR ipad) ∥ message)). The receiver recomputes the tag over identical encoded bytes. A digest by itself does not authenticate the sender.
Worked example and engineering interpretation
For SHA-256, the digest is 32 bytes and HMAC's internal block size is 64 bytes; these are different quantities. Change one byte of a classroom message and compare the old tag with a freshly computed tag. Verify tag rejection rather than infer authenticity from digest length.
Engineering principles · additional worked teaching example
HMAC combines a secret and a hash with inner/outer padding. Unkeyed SHA-256 can detect accidental change against a trusted reference but cannot authenticate a sender by itself. JSON whitespace changes bytes unless canonicalized by an agreed encoding.
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 K06 · Hashing & HMAC telemetry integrity
Verify SHA-256 and HMAC behavior for original and modified telemetry.
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: Verify SHA-256 and HMAC behavior for original and modified telemetry.
Record both 64-character SHA-256 digests and both HMAC tags for identical JSON. Expect zero changed digest bits and HMAC verification.
Change receiver temperature to 35; record the actual XOR bit distance, not an assumed 128.
Restore the original received bytes and change only verifier key; digests match but HMAC fails.
Add one trailing space to the JSON; compare exact byte lengths and digest results.
Reference check:
Model boundary:
Independent task and submission evidence
2. Change receiver temperature to 35; record the actual XOR bit distance, not an assumed 128. 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.
Worked engineering reasoning and boundary conditions
Engineering reference configuration: Sender JSON = {"temperature":25}; Receiver JSON = {"temperature":25}; Sender demo key = demo-shared-key; Verifier demo key = demo-shared-key. In the classroom model, Changed hash bits = 0; SHA-256 matches = Yes; HMAC verifies = Yes. Digest equality depends only on the bytes; HMAC verification also depends on the shared key. Actual SHA-256 and HMAC-SHA-256; fictional keys only.
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 · independent state notebook
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.
Teaching example only; inspect live calculations or real practical evidence separately.
Recall the concept before revealing its explanation.
0 / 3 revealed
K06 · 01 / 08Hash versus HMAC?Reveal explanation
Engineering explanation
A hash is unkeyed; HMAC authenticates bytes using a shared secret.
K06 · 02 / 08Why modify input in a test?Reveal explanation
Engineering explanation
A correct verification procedure should reject changed authenticated data.
K06 · 03 / 08What inputs and independent checks are required before comparing digest and HMAC?Reveal explanation
Engineering explanation
Run from ~/kali-labs after init. Inspect JSON checks, not secret material. Keep the original and altered verification outcomes distinct.
K06 · 04 / 08How do SHA-256 and HMAC-SHA-256 differ?Reveal explanation
Engineering reasoning
SHA-256 is an unkeyed digest; HMAC uses a shared secret to authenticate data integrity.
K06 · 05 / 08Why test altered telemetry against the original HMAC?Reveal explanation
Engineering reasoning
An altered message should not validate under the original tag; compare verification outcome rather than visual digest similarity.
K06 · 06 / 08An original telemetry payload is modified. Select every technically valid statement.
A. SHA-256 digests can detect differences against a trusted digest.
B. HMAC requires a secret key to authenticate a message.
C. An unkeyed hash authenticates a sender by itself.
D. HMAC encrypts the message contents.Reveal explanation
Applied scenario
Correct: A. SHA-256 digests can detect differences against a trusted digest.; B. HMAC requires a secret key to authenticate a message.
K06 · 07 / 08In K06 · Hashing & HMAC telemetry integrity, which command or code executes the final documented practical action?Reveal explanation
K06 · 08 / 08For K06 · Hashing & HMAC telemetry integrity, which actual output or state confirms the prescribed practical run succeeded, and what does it not establish?Reveal explanation
Evidence & acceptance
Run lab.py integrity from ~/kali-labs; no broker required. Confirm each JSON check pass. Hash changes detect bytes; HMAC verifies with shared secret. Do not assume a fixed number of changed bits or expose the key.
Loading experiment-specific apparatus…Previous model / additional reference tools
Simulation task
Verify SHA-256 and HMAC behavior for original and modified telemetry.
Explore the model using its own controls. Record a prediction before changing a condition. Compare the reference with a changed condition, then use the Experiment tab for the procedure, acceptance criteria and notebook. Model outputs and physical observations must remain separate.
Predict the outcome, change either condition, then compare the modeled decision. This illustrates the selected control criteria, not a full implementation or measurement.
01 · InputAuthenticated telemetry
→
02 · Evaluate2 of 2 checks
→
03 · OutcomeConditions met
CONTROL PATH · VIRTUAL INSTRUMENTCONDITIONS MET
Signal path illustrates a decision rule. The indicator is not actual network traffic, cryptographic verification or device measurement.
HMAC verification expected to pass
Reference conditions selected.
Reference conditions selected.
Complete the actual local Kali procedure below. The workbench does not send packets, perform cryptography, inspect a device or establish that real controls are effective.
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.
Run from ~/kali-labs after init. Inspect JSON checks, not secret material. Keep the original and altered verification outcomes distinct.
Experimental protocol
Prerequisites
K01; Python standard library
Procedure
Compare original and altered SHA-256 digests; verify original HMAC and altered payload.
Acceptance
Three checks pass. Unkeyed hash alone does not authenticate a sender.
Evidence
K06-INTEGRITY.json; changed bit count varies with selected inputs, no secret key.
Standards link
Data protection / integrity
Discussion
Why could an untrusted sender recompute an unkeyed hash?
Run & verify — acceptance checklist
Build verification: Actual SHA-256 and HMAC controls passed.
Run lab.py integrity from ~/kali-labs; no broker required. Confirm each JSON check pass. Hash changes detect bytes; HMAC verifies with shared secret. Do not assume a fixed number of changed bits or expose the key.
Record the actual output, source (mock/model or physical), and any error. A missing tool, timeout or untested external service is not a pass.
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
Write the UTF-8 byte sequence for {"temperature":25} and identify how changing 25 to 26 alters the input bytes.
Engineering method — HMAC combines a secret and a hash with inner/outer padding. Unkeyed SHA-256 can detect accidental change against a trusted reference but cannot authenticate a sender by itself. JSON whitespace changes bytes unless canonicalized by an agreed encoding. Apply this method to the assigned values independently; compare your reasoning with the relevant simulator or practical implementation.
02 · Compare or justify using evidence
Using the HMAC formula, predict verification for changed message, changed verification key and matching pair. Explain why an unkeyed digest alone does not authenticate a sender.
Engineering method — HMAC combines a secret and a hash with inner/outer padding. Unkeyed SHA-256 can detect accidental change against a trusted reference but cannot authenticate a sender by itself. JSON whitespace changes bytes unless canonicalized by an agreed encoding. Apply this method to the assigned values independently; compare your reasoning with the relevant simulator or practical implementation.
03 · Code interpretation
Code interpretation · Independent work
Sender authenticates bytes '{"v":1}' and receiver verifies '{"v": 1}'. What happens assuming HMAC-SHA256 and same key? Suggest a remedy.
Code interpretation — HMAC combines a secret and a hash with inner/outer padding. Unkeyed SHA-256 can detect accidental change against a trusted reference but cannot authenticate a sender by itself. JSON whitespace changes bytes unless canonicalized by an agreed encoding. 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.
Intermediate · Explain a changed-input result
Independent theoretical exercise · K06-01
Use the reference configuration (Sender JSON = {"temperature":25}; Receiver JSON = {"temperature":25}; Sender demo key = demo-shared-key; Verifier demo key = demo-shared-key), but change Receiver JSON = {"temperature":35}. The model reports Changed hash bits = 124. Explain the governing rule and assumptions that make this output plausible; identify an independent verification method.
Intermediate · Quantitative comparison
Independent theoretical exercise · K06-02
Two model observations of Changed hash bits are 0 (reference) and 124 (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 · K06-03
For Verifier demo key = other-key, the model supplies this excerpt from Byte and digest comparison:
Field · Sender · Receiver
UTF-8 bytes · 7b2274656d7065726174757265223a32357d · 7b2274656d7065726174757265223a32357d
SHA-256 · 075286bf2b21db869b4a185dec259b8f4a6befe4b085bce0eb4126521a4ead0a · 075286bf2b21db869b4a185dec259b8f4a6befe4b085bce0eb4126521a4ead0a
HMAC-SHA-256 · 752a5884839896776dac85e9e3ee0ec87e0ae5cd697dcb6d23dbab0c614052a8 · 541c959036be2a4291a7b494bd3e94ab13d37f372c2307816b866713ebabfd03
Count rows whose Sender value is exactly “7b2274656d7065726174757265223a32357d”, and identify the displayed row numbers. Explain what the count describes.
Advanced · Reverse reasoning
Independent theoretical exercise · K06-04
An observation is HMAC verifies = No. Candidate A uses Sender JSON = {"temperature":25}; Receiver JSON = {"temperature":25}; Sender demo key = demo-shared-key; Verifier demo key = demo-shared-key. Candidate B changes the listed settings (Verifier demo key = other-key) 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 · K06-05
A student configures Verifier demo key = other-key while preserving all other reference settings, but copies the reference report of HMAC verifies = Yes. Evaluate whether the report is justified. Identify the first configuration/output check to perform.
Challenging · Design a controlled verification
Independent theoretical exercise · K06-06
Design a controlled comparison for K06 · Hashing & HMAC telemetry integrity using reference Sender JSON = {"temperature":25}; Receiver JSON = {"temperature":25}; Sender demo key = demo-shared-key; Verifier demo key = demo-shared-key and test Receiver JSON = {"temperature":35}. Specify the changed setting(s), measured metric Changed hash bits, controls, repetitions, an acceptance check and what evidence can distinguish an actual implementation from the model.
Step-by-step experimental procedure
Distinguish unkeyed digest comparison from authenticated integrity.
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.
Sender JSON{"temperature":25}
Receiver JSON{"temperature":25}
Sender demo keydemo-shared-key
Verifier demo keydemo-shared-key
2 · Perform the investigation in order
Record both 64-character SHA-256 digests and both HMAC tags for identical JSON. Expect zero changed digest bits and HMAC verification.
Change receiver temperature to 35; record the actual XOR bit distance, not an assumed 128.
Restore the original received bytes and change only verifier key; digests match but HMAC fails.
Add one trailing space to the JSON; compare exact byte lengths and digest results.
Run lab.py integrity locally and inspect the generated evidence; its random key need not produce your browser tag.
3 · Compare controlled trials
Trial
Independent change
Expected check
Observation
Original
Use reference inputs above
HMAC verifies: Yes; Changed hash bits: 0
Record actual result
Altered temperature
Receiver JSON = {"temperature":35}
HMAC verifies: No
Record actual result
Wrong key
Verifier demo key = other-key
HMAC verifies: No; Changed hash bits: 0
Record actual result
4 · Analyze and report
Explain why a party able to alter data can recompute an unkeyed hash.
Required evidence: Exact input bytes, tags, bit counts and local integrity checks.
Model boundary: Actual SHA-256 and HMAC-SHA-256; fictional keys only.
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.
Trial
Independent change
Dependent observation
Original
Use reference inputs above
Record actual outcome and units
Altered temperature
Receiver JSON = {"temperature":35}
Record actual outcome and units
Wrong key
Verifier demo key = other-key
Record 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.
✓ 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.
Keyed integrity · method and source
SHA-256 is unkeyed. HMAC uses a secret key, and the receiver recomputes the tag using the exact message bytes. The key is randomly generated and never included in the evidence record.
Inspect the actual implementation below. Full file: lab.py.
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: Default computational cells passed isolated local Python execution; physical equipment and live services require separate verification.
01Instructions · Markdown
# K06 · K06 · Hashing & HMAC telemetry integrity
**PSUT IoT Engineering Studio — Dr. Mohammad Alja’afreh**
## Introduction
Verify SHA-256 and HMAC behavior for original and modified telemetry.
## 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
Verify SHA-256 and HMAC behavior for original and modified telemetry.
**Reference procedure (use the matching simulator/WSL tool where named, not an unrelated service):**
1. Record both 64-character SHA-256 digests and both HMAC tags for identical JSON. Expect zero changed digest bits and HMAC verification.
2. Change receiver temperature to 35; record the actual XOR bit distance, not an assumed 128.
3. Restore the original received bytes and change only verifier key; digests match but HMAC fails.
4. Add one trailing space to the JSON; compare exact byte lengths and digest results.
5. Run lab.py integrity locally and inspect the generated evidence; its random key need not produce your browser tag.
**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
# =====================================================================
# K06 | Code cell 01 | K06 · Hashing & HMAC telemetry integrity
# 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)
## 3. Implementation
Read the comments and variable definitions before execution. Assertions must pass; inspect values, not just completion.
06Python · executable cell
PYTHON · Code cell
# =====================================================================
# K06 | Code cell 02 | K06 · Hashing & HMAC telemetry integrity
# 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 hashlib, 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 integrity; keep its logic separate from the trial.
def integrity():
a=b'{"temperature":25}'; b=b'{"temperature":35}'; key=secrets.token_bytes(32)
digest=hashlib.sha256(a).digest(); other=hashlib.sha256(b).digest();tag=hmac.digest(key,a,'sha256')
return save('K06-INTEGRITY',[check('SHA256 detects changed bytes',digest!=other,'Changed bits: '+str(sum((x^y).bit_count() for x,y in zip(digest,other)))),check('Original HMAC verifies',hmac.compare_digest(tag,hmac.digest(key,a,'sha256')),'match'),check('Modified telemetry rejected',not hmac.compare_digest(tag,hmac.digest(key,b,'sha256')),'mismatch')])
### 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
# =====================================================================
# K06 | Code cell 03 | K06 · Hashing & HMAC telemetry integrity
# 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 integrity()
## 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 integrity
```
```python
def integrity():
a=b'{"temperature":25}'; b=b'{"temperature":35}'; key=secrets.token_bytes(32)
digest=hashlib.sha256(a).digest(); other=hashlib.sha256(b).digest();tag=hmac.digest(key,a,'sha256')
return save('K06-INTEGRITY',[check('SHA256 detects changed bytes',digest!=other,'Changed bits: '+str(sum((x^y).bit_count() for x,y in zip(digest,other)))),check('Original HMAC verifies',hmac.compare_digest(tag,hmac.digest(key,a,'sha256')),'match'),check('Modified telemetry rejected',not hmac.compare_digest(tag,hmac.digest(key,b,'sha256')),'mismatch')])
```
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. Change receiver temperature to 35; record the actual XOR bit distance, not an assumed 128. 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 studiesConcurrent-device simulation & Monte Carlo research