Skip to main content
Cyber Defense StudioIoT Security and PrivacyExperimentsWorkspaces
IoTPSUT IoT Engineering StudioPrincess Sumaya University for Technology · Dr. Mohammad Alja’afreh
BLOCKCHAIN FOR IoT · BC-M02
Blockchain for IoT

Hashing, authentication and avalanche

Dr. Mohammad Alja’afreh · Princess Sumaya University for Technology

UTF-8SHA-256Digest
Design experiment & verify evidence →
BC-M02 · Laboratory mentorAsk about the current experiment, its algorithms or Python notebook.
Ask Dr. MohammadAdaptive practice

← Lecture-aligned module experiments · All blockchain labs · Setup wizard

Introduction

Scientific architecture · Message authentication, SHA and public-key cryptography

Hash, MAC, signature, encryption — Same message / encoded bytes; Hash / unkeyed digest; HMAC / secret-key integrity; Signature / public verification; Encryption / confidentiality
Scientific concept map: Message bytes — UTF-8; SHA — Digest, no secret; HMAC — Shared-key authentication; Signature — Private key / public verify; Encryption — Confidentiality separate.

Scientific foundations and analytical reasoning

Hashing, message authentication, encryption and signatures serve different goals. Verification depends on exact bytes and the appropriate key.

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.

Related course access: IoT Security and Privacy — same laboratory, notebook and completion record.

BC-M02 · Academic orientation

Scope and objectives

Scope of the experiment

Distinguish a digest from confidentiality and origin authentication. Observe SHA-256 and SHA-512 concepts, digest comparison and avalanche effects using actual SHA-256 computations.

The focus of this experiment is to distinguish digest, encryption and keyed authentication. Students then calculate and compare hash avalanche observations, and verify integrity and explain the trust requirement for reference values. 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 digest, encryption and keyed authentication.
  • Calculate and compare hash avalanche observations.
  • Verify integrity and explain the trust requirement for reference values.
  • Identify the configured inputs (Original message; Receiver message; Sender demo HMAC key; Verifier demo HMAC key; Additional operation) 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 digest, encryption and keyed authentication, calculate and compare hash avalanche observations, and verify integrity and explain the trust requirement for reference values.

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 integrity and explain the trust requirement for reference values. 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 Decentralization, replication and CAP.

Environment and experimental methodology

The listed browser model and experiment-specific local Python, Solidity or EVM workflow, where provided. Do not treat a model as a deployed ledger.

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.

Scientific theory · Cryptographic primitive distinctions

A hash commits bytes without a key; a MAC uses a shared key to authenticate; a signature uses a private key with public verification; encryption protects confidentiality. AEAD combines encryption and authentication including associated data. Avalanche describes sensitivity of output to changes, not a proof of collision resistance.

Worked example and engineering interpretation

Changing a single input bit usually changes many digest bits. Compare two SHA-256 digests using XOR and Hamming distance; the distance lies between 0 and 256. A shared-key MAC can be produced by any key holder, unlike a signature verified against an independently trusted public key.

Engineering principles · additional worked teaching example

A digest compares exact byte sequences against a trusted reference; HMAC uses a shared secret to authenticate them. Hamming distance counts XOR set bits: 0xA5 XOR 0xA1=0x04, one differing bit. This small example explains the metric, not SHA-256 output.

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.

Worked engineering reasoning and boundary conditions

Engineering reference configuration: Original message = temperature=25; Receiver message = temperature=25; Sender demo HMAC key = lab-key; Verifier demo HMAC key = lab-key; Additional operation = ECDSA signature. In the classroom model, Changed SHA-256 bits = 0; Changed SHA-512 bits = 0; HMAC verifies = Yes; Signature verifies = Yes. The same message can have a matching digest but fail HMAC when the verification key is wrong. Digital signature and encryption use different key operations. Actual browser Web Crypto and SHA-256 fallback; ephemeral teaching keys. RSA-OAEP plaintext is bounded by the RSA-2048/SHA-256 message limit.

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.

Hashing, authentication and avalanche: independent state notebook1234Calculated state 1OperationInput hexOriginal74656d70657261747572653d3235Candidate74656d70657261747572653d3235

Step 1 of 4 · Calculated state 1

Calculated state 1

Operation
Input hex
Original
74656d70657261747572653d3235
Candidate
74656d70657261747572653d3235

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

How to investigate Hashing, authentication and avalanche

Distinguish a digest from confidentiality and origin authentication. Observe SHA-256 and SHA-512 concepts, digest comparison and avalanche effects using actual SHA-256 computations.

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: Distinguish a digest from confidentiality and origin authentication. Observe SHA-256 and SHA-512 concepts, digest comparison and avalanche effects using actual SHA-256 computations.

  1. Enter identical original and candidate text. Inspect UTF-8 bytes, both SHA sizes and the changed-bit count (0).
  2. Change one character, then add one space instead. Compare actual 256- and 512-bit Hamming distances; avalanche is a statistical property, not exactly half every time.
  3. Keep candidate identical but change verifier HMAC key. Verify hash equality remains true while authentication fails.
  4. Select ECDSA and modify candidate again; observe signature verification. The verifier does not need the private key.

Reference check: Identical strings yield the same digest and zero changed bits. A changed sample yields a different digest; bit distance is measured, not prescribed.

Model boundary: An unkeyed hash is not a MAC, signature or encryption. SHA-512 and signature examples remain conceptual unless separately executed.

Independent task and submission evidence

2. Change one character, then add one space instead. Compare actual 256- and 512-bit Hamming distances; avalanche is a statistical property, not exactly half every time. 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.

Distinguish a digest from confidentiality and origin authentication. Observe SHA-256 and SHA-512 concepts, digest comparison and avalanche effects using actual SHA-256 computations.

Learning goals

  1. Explain the mechanism using the actual intermediate states in this experiment.
  2. Predict and verify the reference and modified conditions described below.
  3. Interpret the acceptance criteria and identify the limits of the model.

Module flashcards · 12 questions

Browse all 12 questions and explanations
How many bits are in SHA-256 and SHA-512 digests?

256 and 512 respectively.

Is a SHA-256 digest a MAC?

No. A MAC requires a secret key and provides a different security property.

What does avalanche mean?

A small input change tends to cause a large digest change; not exactly 128 bits for every pair.

Why hash UTF-8 bytes consistently?

Different encodings can represent different byte strings and therefore different digests.

How many hexadecimal characters represent SHA-256?

64, since each hex digit represents four bits.

How do we calculate the bit distance?

XOR corresponding digest bits and count the one bits.

Does hashing encrypt the original message?

No; it is a one-way digest function, not reversible encryption.

What can HMAC provide that a bare digest cannot?

Message authentication with a shared secret key, subject to key security and freshness controls.

What is the bit distance when both inputs are temperature=25?

Zero, because the SHA-256 digests are identical.

What does changing temperature=25 to temperature=26 test?

Avalanche behavior; compare the calculated digest bits.

Must every one-character change flip exactly 128 bits?

No. The observed Hamming distance varies.

Why test a trailing space separately?

It changes the UTF-8 byte sequence even if the visible text looks similar.

BC-M02 engineering diagram
Engineering diagram · BC-M02. Use the interactive workstation to investigate the calculated state.
Shared research workbenches · network designer & advanced studies
Concurrent-device simulation & Monte Carlo research
Distributed digital twin · topology, protocol & battery research