Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement Key-Value Map Filter #1

Merged
merged 33 commits into from
Jan 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
b3157d4
Update gitignore file to conform to Rust project
itzmeanjan Jan 9, 2025
0cb2d66
Add cargo.toml file
itzmeanjan Jan 9, 2025
55bb1f1
Add Matrix struct
itzmeanjan Jan 9, 2025
7bf2539
Generate matrix of dimension `m x n`, given a 32 -bytes seed
itzmeanjan Jan 9, 2025
50af1b3
Add binary fuse filter utility functions
itzmeanjan Jan 9, 2025
00db8d4
Implement function for computing Sha3_256 hash of arbitrary length key
itzmeanjan Jan 9, 2025
f52c8c3
Add function to compute batch hash
itzmeanjan Jan 9, 2025
2facb5c
Add dependency for generating cryptographically secure PRNG
itzmeanjan Jan 9, 2025
410800a
Make small functions inline always
itzmeanjan Jan 10, 2025
341a290
Add function for filling a `u64` result, in little-endian order, from…
itzmeanjan Jan 10, 2025
cd96a01
Add function for converting a (key, value) pair to a row of the database
itzmeanjan Jan 11, 2025
29858e8
Add function for decoding a row as (hashed-key, value) pair
itzmeanjan Jan 11, 2025
f01af1c
Correctly compute matrix element mask
itzmeanjan Jan 11, 2025
3c159b3
Handle encoding value boundary `0x81`
itzmeanjan Jan 11, 2025
0d3ecc9
Decode row such that it checks if key-value pair encoding is valid
itzmeanjan Jan 11, 2025
a8753a7
Check if decoded row is zeroed post boundary mark
itzmeanjan Jan 11, 2025
acd9705
Minor change of variable name
itzmeanjan Jan 11, 2025
d8d0cbb
Add test to ensure that encoding (key,value) pair as row and recoveri…
itzmeanjan Jan 11, 2025
40ed3c6
Add test configuration macro
itzmeanjan Jan 11, 2025
de6bc4c
Extend encoding/decoding of (key,value) pair test, covering more scen…
itzmeanjan Jan 13, 2025
c5a2682
Add function to encode a key-value map into a database matrix
itzmeanjan Jan 13, 2025
efb3356
Extract Binary-Fuse-Filter implementation from function parsing KV da…
itzmeanjan Jan 13, 2025
0ddeae5
Update function encoding KV database as matrix to use explicit functi…
itzmeanjan Jan 13, 2025
26df383
Bumped column-limit (max-width in rustfmt lingo) to 160, reformatted …
itzmeanjan Jan 13, 2025
d77fd34
Extract function for serializing a (key, value) pair to a row of matr…
itzmeanjan Jan 13, 2025
eb8e602
Extract binary fuse filter associated functions as module functions
itzmeanjan Jan 13, 2025
091b94f
Keep matrix element bit length in BFF struct
itzmeanjan Jan 13, 2025
97fe629
Add function for recovering value from KV database encoded as matrix
itzmeanjan Jan 13, 2025
202cb87
Make slice of appropriate length before copying into it
itzmeanjan Jan 13, 2025
d5bccdf
Add test ensuring functional correctness of encoding key-value map as…
itzmeanjan Jan 13, 2025
669600d
Change what parameters test is run with
itzmeanjan Jan 13, 2025
5edd21c
Add Github Actions CI script to run tests
itzmeanjan Jan 13, 2025
e797e85
Reduce input param range, so that test run finishes quick enough
itzmeanjan Jan 13, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions .github/workflows/test_ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Taken from https://github.com/itzmeanjan/ascon/blob/644e5c0ee64da42e3c187adb84ba4c43925caf30/.github/workflows/test_ci.yml
name: Test ChalametPIR - Private Information Retrieval for Key-Value Maps

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

env:
CARGO_TERM_COLOR: always

jobs:
build:
runs-on: ${{matrix.os}}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]

steps:
- uses: actions/checkout@v4

- name: Build and Test on ${{ matrix.os }}
run: cargo test --lib --release
45 changes: 17 additions & 28 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,32 +1,21 @@
# Prerequisites
*.d
# Generated by Cargo
# will have compiled files and executables
debug/
target/

# Compiled Object files
*.slo
*.lo
*.o
*.obj
# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html
Cargo.lock

# Precompiled Headers
*.gch
*.pch
# These are backup files generated by rustfmt
**/*.rs.bk

# Compiled Dynamic libraries
*.so
*.dylib
*.dll
# MSVC Windows builds of rustc generate these, which store debugging information
*.pdb

# Fortran module files
*.mod
*.smod

# Compiled Static libraries
*.lai
*.la
*.a
*.lib

# Executables
*.exe
*.out
*.app
# RustRover
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/
1 change: 1 addition & 0 deletions .rustfmt.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
max_width = 160
9 changes: 9 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[package]
name = "chalamet_pir"
version = "0.1.0"
edition = "2021"

[dependencies]
sha3 = "=0.10.8"
rand = "=0.8.5"
rand_chacha = "=0.3.1"
Loading
Loading