Crypto Lab

Worksheet · Library privacy, for iSchools

Worksheet: Shelf Oracle

Exhibit
Shelf Oracle
Time
About 25 minutes of class time; Predict is pre-class reading and Explain is a spoken debrief
Checked against
Lab commit 66c860a4a312 on 2026-09-22

Outcomes this worksheet serves

Raw Markdown to edit View source on GitHub Hand-out for the whole module

Predict

Answer these before you open the exhibit. There are no penalties for wrong predictions; the point is to compare them with what you see.

  1. In this design the catalog holds 64 records, and a patron's request is a list of 64 numbers: a 1 at the position of the book they want and a 0 at every other position. Each of the 64 numbers is encrypted separately before it is sent, so the catalog server receives 64 encrypted numbers and no position. If you were shown those 64 encrypted entries and told that exactly one of them hides the 1, how often would a guess be right? Write the fraction, and say whether you think staring at the encrypted bytes could beat it.
  2. Encryption normally draws fresh random values for every single thing it encrypts. Predict what happens to those 64 encryptions if every one of them is made with the same random values instead: would the encryptions of 0 still look different from each other, and would the one encryption of 1 stand out?
  3. Two ways to build a catalog that does not learn which book you asked for. One needs two separate operators who never compare notes. The other needs one operator and a hard mathematical problem. Predict which is cheaper to run — fewer bytes sent, less time spent — and which asks less of the people running it. Say which of the two assumptions you would rather a library depend on, and why.
  4. Suppose the catalog genuinely never learns which book was requested. List three things that someone watching the network between the patron and the catalog could still write down.

Do

  1. Open the exhibit. It opens on The Shelf. Leave Record size at 512 bytes and Shelf length at 64 records for the whole worksheet.
  2. Under Pick a book, press the button for one book on the shelf. Do this once, now. Write down the position number and the title. Then read the card headed The record the protocol will return and note that what comes back is the record itself, not a yes-or-no answer.
  3. Open The Server's View. Under What you send the page draws your list of 64 numbers in the clear, then a grid of opaque tiles below it, one tile per shelf position, and a line reading "Pick a tile. Which one encrypts the 1?". Press the tile you think hides the 1. Record your guess, and what the page said, in the first row of the first table under Record.
  4. Move to the card headed Break it yourself. It holds one switch, and directly under it a red panel that begins "Deliberately broken." Turn that switch on. The tiles above are redrawn. Look along their hex and record, in the second row of the first table, how many of them now look alike. Pick the odd one out, press it, and record that guess too.
  5. Turn that switch back off, so the encryption goes back to the way the protocol actually works.
  6. Still under Break it yourself, press the filled button whose label says how many trials it will run. It runs one crude attack twice over: once against encryptions made with fresh randomness and once against encryptions that reuse it. Wait for the two result boxes and fill in the second table from them, including the chance figure the page prints beside the first box. Then open the disclosure at the foot of that card and read its three paragraphs; you will need them in Explain.
  7. Open One Server vs Two. In the card headed Run both protocols over the same shelf, press the filled button that runs both of them. Fill in the third table from the comparison table that appears, including which cell in each row carries the word "better".
  8. In the same card, the page now says "The two-server scheme rests on one assumption. Press the red button to spend it." Press it. Record, in the fourth table, the shelf position it names beside the position you chose in step 2.
  9. Open What It Does Not Hide. Under What a network observer sees the page says "The observer has seen nothing yet. Run a few queries — try different books." Do that: press the filled button — the one that queries a random book — three times. Record the three rows of the observer's log in the fifth table, and read the two boxes underneath it.
  10. Still on that tab, read the table under What is hidden, and by what and copy the status and the "Where that comes from" cell for the four properties listed in the sixth table.

Record

Every value in these tables comes from your own run.

EncryptionTile I pickedRight or wrongPosition the page said held the 1How many tiles looked alike
Fresh randomness, switch offblank for your answerblank for your answerblank for your answerblank for your answer
Randomness reused, switch onblank for your answerblank for your answerblank for your answerblank for your answer
Reading from the trial boxesValue
Trials runblank for your answer
Fresh randomness, number correctblank for your answer
Fresh randomness, percentblank for your answer
Reused randomness, number correctblank for your answer
Reused randomness, percentblank for your answer
The chance figure printed beside the fresh boxblank for your answer
Row on the comparison tableOne server, RLWETwo servers, XORWhich cell is marked "better"
Servers requiredblank for your answerblank for your answerblank for your answer
Trust assumptionblank for your answerblank for your answerblank for your answer
Privacyblank for your answerblank for your answerblank for your answer
Upload per queryblank for your answerblank for your answerblank for your answer
Download per queryblank for your answerblank for your answerblank for your answer
Records touchedblank for your answerblank for your answerblank for your answer
Can the answer be wrong?blank for your answerblank for your answerblank for your answer
ReadingValue
Shelf position I chose in step 2blank for your answer
Position the two servers named after comparing notesblank for your answer
QueryAt (ms)UploadedDownloadedBook (not observable)
1blank for your answerblank for your answerblank for your answerblank for your answer
2blank for your answerblank for your answerblank for your answerblank for your answer
3blank for your answerblank for your answerblank for your answerblank for your answer
Property, as the page names itStatusWhere the page says that comes from
Which record was requestedblank for your answerblank for your answer
That a query happenedblank for your answerblank for your answer
When it happenedblank for your answerblank for your answer
Who is askingblank for your answerblank for your answer

Explain

The lab's own README states the threat model these questions work inside: an honest-but-curious server that follows the protocol and tries to learn the position from what it receives, and a passive network observer that sees traffic but no plaintext.

  1. Your guess in step 3 was one tile out of 64, and the page told you straight away whether it was right. A single result like that cannot settle whether the encryption is doing its job, in either direction. Using the two counts in your second table, say what the repeated trials establish that one guess cannot, and say what the chance figure you recorded is the chance of.
  2. Between your two guesses nothing about the attack changed: the same eyes, the same tiles, the same question. Using what you recorded in the first table and the three paragraphs in the disclosure you opened in step 6, explain what reusing one set of random values does to 64 encryptions of 0, and why that makes the single encryption of 1 findable by someone who has no key at all.
  3. Look at your third table. The two-server column wins every row that is a cost. Name the two rows where it does not win, say in your own words why the page calls those two rows the same fact said twice, and say what the red button in step 8 did to the two-server column's advantage.

Fix / Extend

  1. Fix. A vendor offers your library a private catalog search and says the search service never learns which title a patron looked up. Using your third table and the card headed Honest scope on What It Does Not Hide, write the two questions you would put to that vendor before believing the sentence: one naming the assumption the claim rests on, and one naming the party who has to be trusted for it to hold. For each, say what answer would satisfy you and what answer would not, and say which of the two designs in your third table the vendor's answers would place them in.
  2. Extend. Open One Server vs Two and, in the card headed What the numbers do not say, open the disclosure at the foot of that card. The second of its three paragraphs describes running two servers under genuinely separate control as "an organisational problem, not a technical one". A patron standing at a catalog terminal can see neither operator's records. Using that phrase and your fourth table, filled in step 8, say what such a patron could check for themselves about whether the two operators are staying apart, and what they would have to take on trust instead. Then open What It Does Not Hide, read the card headed Honest scope, and say what the one-server column asks you to believe in place of non-collusion, and what that card says this page does not prove.
  3. Extend. Your observer log, recorded into the fifth table in step 9, has columns that came out identical across the three rows and a column that did not. Open What It Does Not Hide and go back to the card headed What a network observer sees; if its log is empty because the page was reloaded or a setting changed since, press the filled button — the one that queries a random book — three times again, so the two boxes under the log are on screen. Using your three recorded rows, those two boxes and the four properties in your sixth table, say which single fact about a patron's request this design keeps from a network observer, and list what it leaves that observer holding. Then pick one item from that list which a library could reduce by something other than encryption, and say what the page suggests would reduce it.
  4. Extend. Open Homomorphic Selection and use the buttons in the card headed The homomorphic inner product to fold the records into the answer one at a time, then eight at a time, then the rest. Watch the running answer and the measured budget as you go. Before the record you chose has been reached, what does the page say the accumulator decrypts to — and why does the budget fall anyway? Use the page's own three-line account of why the sum does the selecting.
  5. Extend. Back on The Shelf, in the card headed This run, type a string into Run seed and press Pin this seed. Read the warning the page then prints beside it. Get a classmate to pin the same string and pick the same shelf position, and compare your tiles on The Server's View with theirs. Then say, using that warning, why a real system must never let a run be pinned this way, and how this failure is related to the one you produced in step 4.
  6. Extend. Do this one last, because it discards everything you measured. Open Noise Exhaustion and, in the card headed Push it until it breaks, lower the ciphertext modulus one step at a time, retrieving at each setting, until the page reports a failure code instead of your record. Record the code and the three figures the page reports with it. Then, using the note printed under those figures, say which of those three checks a real patron's own software could run for itself, and which it could not — and say why that distinction is the reason the page insists a deployment sizes its parameters in advance. The card headed The failure codes names the other three codes and what raises each.

Crypto Lab exhibits are teaching demonstrations, not production libraries. Do not use exhibit code to protect real data.