Chapter 12 of 22Part III: Cybersecurity and Privacy
Secrets Hidden in Plain Sight
Each project below is tailored to a specific algorithm and scientific question from Chapter 12, with concrete inputs, verifiable numerical outputs, boundary cases, and links to the related lab and pioneer.
Project 1 of 3 · v1-c12-p01Foundational · ~25 min
Bit-Plane Visual Perception Experiment
Lab activity: A. Can you see the difference? · Related code: block-01.js · Pioneer: View profile
Real-World Problem: How much of a digital photograph's visual appearance lives in its high bits vs. its low bits?
Scientific Question: At which bit position (bit 0 through bit 7) do pixel modifications shift from visually imperceptible to clearly visible?
Objective: Toggle individual bit planes (0–7) of an RGB pixel grid and measure brightness deltas and visual artifacts.
Hypothesis to Test: Changing bit 0 shifts a channel by at most 1/255 (often visually imperceptible), whereas changing bit 6 or 7 causes dramatic 64–128 brightness jumps.
Step-by-Step Implementation
Inspect a synthetic gradient image in Activity A of the Chapter 12 Lab.
Modify only bit 0 (LSB) across pixels and compare side by side.
Increase the modified bit plane to bits 3, 5, and 7 to watch quantization bands appear.
Plot the bit-0 plane alone to see how statistical/visual inspection reveals hidden patterns.
Concrete Input: RGB pixel (120, 140, 160); flip bit 0 vs. bit 4 vs. bit 7.
Expected Output: Bit 0 flip -> (121, 140, 160) Δ=1; Bit 4 -> Δ=16; Bit 7 -> (248, 140, 160) Δ=128.
Boundary Condition: Even-valued channels increase by +1 on LSB flip; odd-valued channels decrease by −1.
Common Mistake to Avoid: Claiming 1-bit LSB changes are strictly undetectable rather than often visually imperceptible to humans.
Interpreting Results: Human vision has limited contrast sensitivity, but computers inspecting the bit-0 plane detect LSB anomalies readily.
Show Hint, Extension Challenge & Reflection
Hint: Review the worked example and equation in Chapter 12 before testing the boundary case: Even-valued channels increase by +1 on LSB flip; odd-valued channels decrease by −1.
Extension Challenge: Write a bit-plane extractor that visualizes bit 0 of every pixel as pure black (0) or pure white (255).
Reflection Question: Why does Johannes Trithemius's concept of hidden writing differ fundamentally from modern encryption?
Test Cases: Short ASCII -> exact round-trip; Oversized string -> rejected before writing.
Boundary Condition: Multi-byte UTF-8 characters (accented letters) take 2–4 bytes, not 1 byte per character.
Common Mistake to Avoid: Writing into the Alpha (transparency) channel in HTML Canvas where premultiplied alpha alters RGB values.
Interpreting Results: Exact bit-level framing and lossless formats (PNG) are required for LSB payloads to survive.
Show Hint, Extension Challenge & Reflection
Hint: Review the worked example and equation in Chapter 12 before testing the boundary case: Multi-byte UTF-8 characters (accented letters) take 2–4 bytes, not 1 byte per character.
Extension Challenge: Add a 1-bit error check (or encrypt the payload first) before embedding into the LSB plane.
Reflection Question: Why does re-saving an LSB-encoded PNG as a JPEG destroy the hidden bits?
Lab activity: C. Sign your own picture · Related code: block-03.js · Pioneer: View profile
Real-World Problem: Security analysts need methods to test whether a lossless image carries suspicious LSB data.
Scientific Question: How does replacing LSBs with uniform random bits distort natural adjacent-value (2k, 2k+1) pixel histograms?
Objective: Compare pair-of-values (PoV) counts in a natural smooth gradient vs. an LSB-embedded image.
Hypothesis to Test: Random/encrypted LSB payloads equalize counts of adjacent even/odd pairs (2k and 2k+1), exposing embedding statistically.
Step-by-Step Implementation
Count frequency of each 0–255 brightness value in a clean synthetic image.
Embed a pseudorandom payload across all LSBs.
Compare |count(2k) − count(2k+1)| across all 128 pairs before and after embedding.
Summarize why steganography alone does not guarantee secrecy against statistical inspection.
Concrete Input: Smooth 64×64 grayscale gradient before and after 100% random LSB overwrite.
Expected Output: Original uneven even/odd counts equalize sharply (chi-squared drops toward uniform 50/50 within pairs).
Test Cases: Clean skewed gradient -> large pair imbalance; Full LSB overwrite -> balanced pairs.
Boundary Condition: Very low embedding rates (< 2% of pixels) are much harder to spot with simple pair counts.
Common Mistake to Avoid: Assuming human eyes are the only detector an analyst uses.
Interpreting Results: Steganography and steganalysis are a statistical arms race.
Show Hint, Extension Challenge & Reflection
Hint: Review the worked example and equation in Chapter 12 before testing the boundary case: Very low embedding rates (< 2% of pixels) are much harder to spot with simple pair counts.
Extension Challenge: Test 10%, 50%, and 100% embedding rates and record how pair-imbalance shrinks.
Reflection Question: When is visible watermarking more honest and robust than hidden steganography?