OnionPIR — the hypercube

OnionPIR is a single-server PIR scheme built on lattice-based homomorphic encryption. The textbook construction of homomorphic PIR — encrypt a one-hot selector vector (Enc(0), …, Enc(1), …) and let the server compute the inner product against the database — works in principle, but doesn't scale: the request grows linearly with the database. OnionPIR takes a different route, built around three ideas explored over the next three pages: reshape the database as a hypercube, mix two ciphertext flavors to walk it efficiently, and pack the whole query into a single ciphertext.

Reshape the database as a hypercube of shape N0 × 2 × 2 × … × 2. The paper's standard setup uses N0 = 512 for the initial dimension, then log2(N/N0) binary dimensions (~11 of them for a 1 M-entry database). An index idx becomes a tuple (i0, b1, …, bd−1): the initial dimension picks one of N0 columns, and each binary dimension is a single bit choosing top or bottom half of the remaining cube.

That's the whole data-structuring move. The server walks the hypercube one axis at a time, collapsing it by one dimension at each step. The animation below shows the traversal as pure index arithmetic — no cryptography yet. The next page introduces the two ciphertext flavors that let the server do exactly this walk under encryption, without learning which column or which half was chosen.

Database reshaped: 4 × 2 × 2 hypercube (the paper uses N₀ = 512 and ~11 binary dims; here, N₀ = 4, 2 binary dims) 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 dims 1–2 ↕ dim 0 (initial) → idx = 6 ↓ decompose into tuple i₀ = 2 (pick column) b₁ = 0 (top half) b₂ = 1 (bottom of that half) → entry at (2, 0, 1)
Index 6 decomposes into (i₀=2, b₁=0, b₂=1). The initial dim picks a column; each binary dim picks top or bottom half.