参考文献:
-
Batcher68\] Batcher K E. Sorting networks and their applications\[C\]//Proceedings of the April 30--May 2, 1968, spring joint computer conference. 1968: 307-314.
tology ePrint Archive 2011, 133 (2011)
-
CKS13\] Chatterjee A, Kaushal M, Sengupta I. Accelerating sorting of fully homomorphic encrypted data\[C\]//Progress in Cryptology--INDOCRYPT 2013: 14th International Conference on Cryptology in India, Mumbai, India, December 7-10, 2013. Proceedings 14. Springer International Publishing, 2013: 262-273.
-
EGNS15\] Emmadi N, Gauravaram P, Narumanchi H, et al. Updates on sorting of fully homomorphic encrypted data\[C\]//2015 International Conference on Cloud Computing Research and Innovation (ICCCRI). IEEE, 2015: 19-24.
-
Cha\&Sen17\] Chatterjee A, Sengupta I. Sorting of fully homomorphic encrypted cloud data: Can partitioning be effective?\[J\]. IEEE Transactions on Services Computing, 2017, 13(3): 545-558.
-
CSS20\] Cetin G S, Savaş E, Sunar B. Homomorphic sorting with better scalability\[J\]. IEEE Transactions on Parallel and Distributed Systems, 2020, 32(4): 760-771.
文章目录
- 最初方案
-
- [Swap Circuit](#Swap Circuit)
- [Lazy Sort](#Lazy Sort)
- [Sorting Network](#Sorting Network)
- 深度最优化
-
- [Comparison Matrix](#Comparison Matrix)
- [Direct Sort](#Direct Sort)
- [Greedy Sort](#Greedy Sort)
- 减少乘法数量
-
- [Polynomial Rank Sort](#Polynomial Rank Sort)
- [Frobenius Maps](#Frobenius Maps)
最初方案
Swap Circuit
CKS13\] 给出了第一个同态排序方案。它基于明文空间是 G F ( 2 ) GF(2) GF(2) 的 FHE 方案(full 版本,而非 level 版本),构建了 **Swap 电路** ,然后用 Swap 电路搭建**冒泡排序** 、**插入排序** 。令 a , b a,b a,b 是带符号整数,最高位是符号位;令 β \\beta β 表示 M S B ( a − b ) MSB(a-b) MSB(a−b),于是 a \< b ⟺ β = 1 a\ o i e_{i+1}\>o_i ei+1\>oi,那么序列 e 0 , o 0 , e 1 , o 1 , ⋯ , e n − 1 , o n − 1 e_0,o_0,e_1,o_1,\\cdots,e_{n-1},o_{n-1} e0,o0,e1,o1,⋯,en−1,on−1 就是一个有序数组。

\[EGNS15\] 观察到**基于 Swap 的同态排序算法总是以最坏复杂度运行** ,或者说它的效率与输入数据无关。\[EGNS15\] 简单地用 FHE Swap 电路搭建出了 Bitonic Sort 和 Odd-Even Merge Sort 同态排序网络,计算复杂度固定为 O ( n log 2 n ) O(n \\log\^2 n) O(nlog2n)。
# 深度最优化
## Comparison Matrix
\[CDSS\] 使用了 LHE 而非 FHE 来实现同态排序,只要支持的 Level 级别够高,就可以完全忽略开销极高的 Recrypt 运算。由于 **LHE** 是以**电路** 的形式执行的,排序算法需要先通过**算术化** 消除条件分支,然后再通过**循环展开** 得到无环的排序电路。但是 \[EGNS15\] 使用的 Sorting Network 迭代了 O ( log 2 n ) O(\\log\^2 n) O(log2n) 层,每一层的 Swap 输入都依赖于上一层的 Swap 结果,所以同态乘法深度较高,直接用 LHE 实例化将导致极高的参数规模。
为了降低乘法深度,最直观的思路就是只进行深度为 O ( 1 ) O(1) O(1) 的比较。输入密文 X 0 , ⋯ , X N − 1 X_0,\\cdots,X_{N-1} X0,⋯,XN−1,预计算 **comparison matrix** ,
M : = \[ m 0 , 0 m 0 , 1 ⋯ m 0 , N − 1 m 1 , 0 m 1 , 1 ⋯ m 1 , N − 1 ⋮ ⋱ m N − 1 , 0 m N − 1 , 1 ⋯ m N − 1 , N − 1 \] m i j : = L T ( X i , X j ) = { E n c ( 1 ) , x i \< x j E n c ( 0 ) , o t h e r w i s e M := \\begin{bmatrix} m_{0,0} \& m_{0,1} \& \\cdots \& m_{0,N-1}\\\\ m_{1,0} \& m_{1,1} \& \\cdots \& m_{1,N-1}\\\\ \\vdots \&\& \\ddots\\\\ m_{N-1,0} \& m_{N-1,1} \& \\cdots \& m_{N-1,N-1}\\\\ \\end{bmatrix}\\\\ m_{ij} := LT(X_i, X_j) = \\left\\{\\begin{aligned} Enc(1), \&\& x_i \< x_j\\\\ Enc(0), \&\& otherwise\\\\ \\end{aligned}\\right. M:= m0,0m1,0⋮mN−1,0m0,1m1,1mN−1,1⋯⋯⋱⋯m0,N−1m1,N−1mN−1,N−1 mij:=LT(Xi,Xj)={Enc(1),Enc(0),xi\