Chapter 12 of 22 Part III: Cybersecurity and Privacy

Secrets Hidden in Plain Sight

3 Verified Book Snippets

Every .js file below is byte-identical (SHA-256 verified) to the printed code in Volume 1. Runnable blocks execute inside an isolated sandboxed iframe and Web Worker with a 2-second timeout and zero network access.

Download Chapter ZIP

[0, 1, 0, 1]

File: block-01.js (byte-identical) · 136 bytes · SHA-256: f35cd3cd6b0d…
steganography Standalone runnable

Dependencies: None (standard ES2022 JavaScript). Runs directly in Node.js or the isolated Web Worker sandbox and prints console output.

function leastBit(value) {
  return value % 2;
}
const samples = [154, 155, 0, 255];
console.log(samples.map(leastBit));
// [0, 1, 0, 1]
Download .js

Read Clue (Ch. 12 Example 2)

File: block-02.js (byte-identical) · 345 bytes · SHA-256: 30d42c94752c…
steganography Standalone runnable

Dependencies: None (standard ES2022 JavaScript). Runs directly in Node.js or the isolated Web Worker sandbox and prints console output.

const strip = [120, 121, 122, 122,
               124, 124, 126, 127];
function readClue(values) {
  let number = 0;
  for (const value of values) {
    number = number * 2 + value % 2;
  }
  return String.fromCharCode(number);
}
console.log(readClue(strip)); // A
const rounded = strip.map(v => v - v % 4);
console.log(rounded.map(v => v % 2));
Download .js

Blend (Ch. 12 Example 3)

File: block-03.js (byte-identical) · 300 bytes · SHA-256: 74ca9b7d2bc5…
steganography Standalone runnable

Dependencies: None (standard ES2022 JavaScript). Runs directly in Node.js or the isolated Web Worker sandbox and prints console output.

function blend(source, mark, opacity) {
  return Math.round(source * (1 - opacity)
                    + mark * opacity);
}
const original = [120, 80, 40];
const watermark = [240, 240, 240];
const result = original.map((v, i) =>
  blend(v, watermark[i], 0.25));
console.log(result); // [150, 120, 90]
Download .js