Oblivious sort by key
We describe here briefly the construction of Hamada et al. The only difference with it is that we suggest using Laud's efficient oblivious random permutation protocol instead of the one used in the original paper.
The sort here is, actually, a stable radix sort.
Sort by revealed key
This is a subprotocol, which picks an array of (key, value) pairs and sorts it by key, but leaks keys in process.
It works as follows:
- Do oblivious random permutation.
- Reveal keys and sort the array by them.
Stable sort by -bit register
Consider a short key of size bits. We will now sort an array of size by this key.
- For each , form an indicator vector of size , where .
- Form also a vector , such that .
- For each from to , calculate the running sum . This counts the amount of different values of the key up to the point .
- Calculate the reveal key . This calculates the amount of key values less than the current key value, plus the amount of the key values equal to the current key value before this element - which is exactly the position where the element should land in a sorted array.
- Engage in the revealing sort subprotocol, using as keys.
Stable sort by key
The stable sort by key works by splitting key into -sized registers, and then engaging in a stable sort by registers.
Complexity
Steps of one instance of stable sort by -bit register involve:
- 6 online rounds for equality test.
- 0 rounds
- 0 rounds
- 1 round for multiplication
- n rounds for oblivious permutation and 1 round to open
Therefore, it takes rounds. The size of -bit registers is, therefore, a tradeoff between (exponential) blowup in offline computation and amount of invocations of the stable sort by register.