fix: correct run.sh script parameters and disable HNSW code (v0.3.1)

- Fix syntax error in run.sh: remove extra quote and correct --log-path to --log-file
- Comment out HNSW algorithm implementation in enc.rs and algorithms.rs to simplify codebase
- Bump version to 0.3.1 in Cargo.toml
- Remove HNSW implementation guide and test files
- Add comprehensive project writeup documentation
This commit is contained in:
2025-08-06 21:40:12 +08:00
parent 46b3562de0
commit c2d423445d
10 changed files with 454 additions and 947 deletions

32
writeup.md Normal file
View File

@@ -0,0 +1,32 @@
# 0xfa队 writeup
## 全同态加密算法介绍
加密算法方面选择了thfe算法库方面选择了较为成熟的thfe-rs算法。
### 算法参数
Message bits: 2位
Carry bits: 2位
噪声分布: TUniform (tweaked uniform)
Bootstrap失败概率: ≤ 2^-128 (CPU后端)
## knn算法实现细节
将欧式距离公式拆分:
> sum((a-b)^2)=sum(a^2) - sum(2a\*b) + sum(b^2)
减少了密文态的乘法和加法操作
选择上实现了双调排序将100个距离结果用最大值填充至128个结果。
然后进行并行排序,最后选择前十个密文。
两个操作都使用了rayon库做多核并行计算
## 本地测试结果
在本地i9-10920X12核24线程)情况下运行时间约9min(4min+5min)