Skip to content

Patron Shield

2-Server IT-PIR ยท Chor et al. 1995

Retrieve one book from a catalog by sending each of two servers a random XOR mask that differ in exactly one bit, then XOR the replies to rebuild the record neither server could identify.

Private Information
Retrieval

Every time you search a library catalog, the server learns what you looked for. Your reading interests โ€” medical diagnoses, political views, personal struggles โ€” are logged and potentially exposed.

Private Information Retrieval solves this. You retrieve exactly what you want from a database โ€” and the server learns nothing about which item you chose. It still learns that you queried, and when; PIR hides the index, not the visit.

This demo implements the 1995 Chor et al. two-server IT-PIR protocol. The privacy guarantee is information-theoretic โ€” not computational. No assumptions about server computing power are required. It is provably private, on one condition: the two servers must not collude. Run a query below, then trigger the collusion attack to see exactly why.

Client has target i
Query S (random mask)
Query Sโ€ฒ = S โŠ• {i} (one bit flipped)
Server 1 computes rโ‚
Server 2 computes rโ‚‚
Response rโ‚
Response rโ‚‚
rโ‚ โŠ• rโ‚‚ = book[i] information-theoretically private

Why two servers?

Hiding which record you want looks impossible with one server. The only information-theoretic way to keep a single server from learning your query is to download the entire database every time. PIR's trick is to split the work across two servers โ€” so instead of downloading all N records you send two masks and receive two record-sized XOR responses, neither server learns which record you asked for, and the cost is a trust assumption.

One server ยท stay cheap
You send your exact query. The server returns one record โ€” and logs what you read. No privacy.
One server ยท stay private
Download the whole database and pick locally. Private, but the bandwidth cost scales with the entire catalog. Impractical.
Two servers ยท IT-PIR
Send each a uniformly random mask, XOR the two replies. Cheap and private โ€” as long as they don't collude.

Library Catalog

Select a book to query privately.

No book selected. Click a card to begin.

Protocol Visualizer

Teaching simulation. Both "servers", the full catalog, your selection and every response run inside this one browser tab โ€” there is no network, no trust boundary, and the whole database is already on your machine, so no privacy service is actually being performed. A real deployment needs independently operated replicas, separate query delivery paths, and a client you trust: the JavaScript that reads your click already knows the index before PIR begins.

Select a book above and click Query Privately to watch the IT-PIR protocol execute step by step.

Step 1 of 4

Client generates query pair

Server 1 receives
mask S =
Server 2 receives
mask Sโ€ฒ =
Bit is the only differing bit (highlighted with ring).
Each mask on its own is uniformly random over all values of a 8-bit query, so neither server can determine which bit differs โ€” or which book you want. Only a party holding both can see it.
Step 2 of 4

Server 1 XOR computation

XOR chain (bits set in S):
rโ‚ (first 8 bytes):
Step 3 of 4

Server 2 XOR computation

XOR chain (bits set in Sโ€ฒ):
rโ‚‚ (first 8 bytes):
Step 4 of 4

Client reconstructs the book

rโ‚
rโ‚‚
result
Why it works: every record sits in both sums except yours.
Identical terms cancel โ€” a โŠ• a = 0 โ€” so the whole shared part vanishes. Only db[], which appears on a single side, survives. That survivor is your book.
Retrieved title:
Privacy Analysis

What each server knew

Server 1 saw:
A random subset of slots โ€” no pattern reveals your query.
Server 2 saw:
A different random subset โ€” equally uninformative.

Neither server alone saw your query. Each mask is uniformly random from the server that received it โ€” not merely random-looking. That is the difference between this guarantee and a computational one: there is no distribution to distinguish and no work an unbounded server could do to narrow the index down. The book you retrieved โ€” โ€” stays private as long as the two servers don't pool what they received.

Scoped precisely: from its own mask, either server learns zero information about which record you requested. It does not hide that a query happened, who asked, when, how often, or the response size โ€” those are transport and identity problems this protocol does not address.

The one assumption: the servers must not collude

The two masks are not independent โ€” by construction Sโ€ฒ = S โŠ• {i}, so they differ in exactly one bit: yours. Any party holding both masks recovers your query with a single XOR. That is the price of two-server PIR: you trade the cost of downloading the whole database for the assumption that no single party ever sees both masks.

Note what that assumption does not buy. Privacy and correctness rest on different requirements, and "at least one server is honest" runs them together: index privacy survives as long as no one party holds both masks โ€” one dishonest server learns nothing on its own, however it behaves. But correctness needs both servers to compute honestly. A single malicious server can return arbitrary bytes, and rโ‚ โŠ• rโ‚‚ is then a corrupted record with nothing in this protocol to flag it. Detecting that takes an added integrity mechanism โ€” an authenticated database snapshot, commitments, or verifiable computation โ€” which IT-PIR does not supply.

Naive vs. Private Query

Naive OPAC query
GET /catalog/search?q=[select a book above]

The server receives your exact search term and logs it. Your reading interests are permanently recorded.

How PIR scales โ€” the โˆšN trick

The query above carries one bit per record. Here is how it stays small as the catalog grows.

This demo sends an N-bit mask โ€” one bit per record. Fine for 8 books; a million-record catalog would mean a million-bit query.

Instead, arrange the catalog as a โˆšN ร— โˆšN grid. To fetch the record at (row r, column c), send each server a โˆšN-bit column mask โ€” the two masks differing in only column c. Each server returns one parity per row (โˆšN values); XOR the two replies to rebuild the entire target column, then read row r.

Same information-theoretic privacy, same non-collusion assumption โ€” but the query shrinks from N to โˆšN. The servers see only a random column subset, so c stays hidden, and r is never transmitted. That sublinear cost is why two-server PIR is a landmark result, not just a privacy trick.

Implementation note: this demo packs each query mask into a single 32-bit integer, so its live 1-D protocol is capped at DB_SIZE โ‰ค 32 records (the catalog here is 8). That ceiling is a JavaScript-number convenience, not a property of PIR โ€” the O(n)-communication scaling lesson above is illustrated with the โˆšN slider rather than by actually growing the live database. A production implementation would use a bit-vector or the โˆšN matrix layout to reach realistic catalog sizes.

1-D query (this demo)
10,000 bits
โˆšN matrix query
100 bits
Query shrinks by
100ร—

These three figures count query bits only โ€” what the client sends. Each server still returns a record-sized response, so the total bytes on the wire are the two queries plus two responses; in the matrix scheme each server returns one parity per row, so the responses grow with โˆšN as well. PIR shrinks the query, not the reply.