Cryptography · Study deck

Hash Functions and Data Integrity

Picture a field unit downloading new software and a short check value.

Shield Shelly is your guide for this deck.

hash-functionsintegrityhmac
Shield Shelly, the module guide, in a scene from this chapter.
iotclass.org

After studying this chapter

Learning objectives

You will be able to:

  • Explain: A match can show that the bytes equal the expected copy, but it cannot show who chose that copy unless the expected value is protected.
  • Explain: The digest can tell whether the bytes match an expected value, but it cannot say who chose that value unless the expected value is protected.
  • Explain: Anyone can replace both a message and its unprotected digest, whereas only a holder of the HMAC key should create a valid tag.
  • Explain: Hash one known file, change one byte, use an attacker-chosen expected value, repeat an old release, and restart the verifier.
iotclass.org

Major section

Start With the Fingerprint Question

A match can show that the bytes equal the expected copy, but it cannot show who chose that copy unless the expected value is protected.

  • The first test changes one byte and names the trust source.
  • Firmware means the software stored on a device.
  • A gateway means a device or service that joins two system paths.

Key terms

Telemetry
Telemetry means measurements and status sent for remote use.
iotclass.org

Major section

Start With the Fingerprint Question (continued)

Telemetry means measurements and status sent for remote use.

  • Hash one known file, change one byte, use an attacker-chosen expected value, repeat an old release, and restart the verifier.
  • This runway does not prove identity, secrecy, or freshness from a plain hash.
  • The digest can tell whether the bytes match an expected value, but it cannot say who chose that value unless the expected value is protected.
iotclass.org

Major section

A Fingerprint for Data, Not a Lock and Not a Signature

The release branch then asks whether the primitive, context, failure behavior, and migration path fit that role.

  • This map supplies the distinctions the rest of the chapter will prove.
Hash-based constructions mapped to their distinct security roles
Hash-based constructions mapped to their distinct security roles
iotclass.org

Major section

Choose the Construction and Protect the Expected Value

Anyone can replace both a message and its unprotected digest, whereas only a holder of the HMAC key should create a valid tag.

  • The receiver still needs exact byte and context rules and a constant-time comparison.
A plain hash flags a mismatch but anyone can recompute it; HMAC mixes in a secret key, so a valid tag also proves the sender knew the key.
A plain hash flags a mismatch but anyone can recompute it; HMAC mixes in a secret key, so a valid tag also proves the sender knew the key.
iotclass.org

Major section

Pin One Firmware Image to One Digest

For hash integrity, in this hash-function check, the device may hash the downloaded image and compare it with a signed manifest digest.

  • At the firmware integrity boundary, a matching hash shows the checked bytes match that authenticated expectation.
  • A password KDF adds salt and deliberate work to slow each guess.

Why it matters

For hash integrity, publishing an unsigned digest beside the image is weaker because an attacker who replaces the image can replace the digest too.

Hash-based constructions mapped to their distinct security roles
Hash-based constructions mapped to their distinct security roles
iotclass.org

Deck summary

Key takeaways

A match can show that the bytes equal the expected copy, but it cannot show who chose that copy unless the expected value is protected.

  • Telemetry means measurements and status sent for remote use.
  • The release branch then asks whether the primitive, context, failure behavior, and migration path fit that role.
  • Anyone can replace both a message and its unprotected digest, whereas only a holder of the HMAC key should create a valid tag.
  • For hash integrity, in this hash-function check, the device may hash the downloaded image and compare it with a signed manifest digest.
iotclass.org

Retrieval practice

Recall check 1 of 3

Shield Shelly says: answer from memory, then check your reasoning.

Q1A vendor says, 'We hash the sensor readings, so they are encrypted and safe.' What is the strongest correction?

AHashing is one-way and keyless
BHashing is a strong form of encryption as long as the digest is long enough
CHashing both hides the data and proves who sent it
DThe readings are safe because a hash cannot be reversed
Show answer

Answer: A A hash is not encryption: it cannot be reversed to hide and reveal data, and anyone can recompute it, so it does not authenticate the sender.

iotclass.org

Retrieval practice

Recall check 2 of 3

Shield Shelly says: answer from memory, then check your reasoning.

Q2Two devices share a secret key and need each message to prove it came from the peer and was not altered. A developer appends a plain SHA-256 digest of the message. Why is this insufficient, and what fixes it?

AAnyone who can change the message can recompute the plain digest.
BIt is sufficient, because SHA-256 is collision resistant
CIt is fixed by also sending the message length alongside the digest
DEncrypting the digest with the same hash a second time would authenticate it
Show answer

Answer: A A keyless digest authenticates no one.

iotclass.org

Retrieval practice

Recall check 3 of 3

Shield Shelly says: answer from memory, then check your reasoning.

Q3A team keeps signing firmware manifests with a hash that has known practical collisions, arguing the digest is long enough to be safe. Why is this unsafe specifically for signatures?

AIt is safe, because the signature itself protects the manifest regardless of the hash
BA signature over one colliding manifest can verify another.
CThe only issue is that the digest takes more storage than necessary
DSwitching to a longer digest from the same broken algorithm fixes it
Show answer

Answer: B Signatures bind to a digest, so a usable collision lets a valid signature transfer to a different document.

iotclass.org

Print reference

Answers

Answer key.

  1. A · A hash is not encryption: it cannot be reversed to hide and reveal data, and anyone can recompute it, so it does not authenticate the sender.
  2. A · A keyless digest authenticates no one.
  3. B · Signatures bind to a digest, so a usable collision lets a valid signature transfer to a different document.
iotclass.org