Module psi

Module psi 

Source
Expand description

Private Set Intersection (PSI) for privacy-preserving P2P content discovery.

This module provides protocols for finding common elements between two sets without revealing elements that are not in the intersection.

§Use Cases in CHIE Protocol

  • Content Discovery: Peers can find common content without revealing their full catalogs
  • Privacy-Preserving Matching: Match chunks/files without exposing complete inventories
  • Efficient Peer Selection: Find peers with desired content while maintaining privacy

§Protocol

  1. Hash-based PSI: Uses keyed hashing for exact intersection
  2. Bloom Filter PSI: Uses Bloom filters for approximate intersection with better efficiency

§Example

use chie_crypto::psi::{BloomPsiClient, BloomPsiServer};

// Server has a set of content hashes
let server_set = vec![
    b"content_1".to_vec(),
    b"content_2".to_vec(),
    b"content_3".to_vec(),
];

// Client has their own set
let client_set = vec![
    b"content_2".to_vec(),
    b"content_4".to_vec(),
];

// Server generates Bloom filter PSI
let server = BloomPsiServer::new(10, 0.01);
let bloom_msg = server.encode_set(&server_set);

// Client computes approximate intersection
let client = BloomPsiClient::new();
let intersection = client.compute_intersection(&client_set, &bloom_msg).unwrap();

// Intersection should contain common elements
assert!(intersection.contains(&b"content_2".to_vec()));

Structs§

BloomPsiClient
Bloom filter PSI client
BloomPsiMessage
Bloom filter-based PSI for approximate intersection with better efficiency
BloomPsiServer
Bloom filter PSI server
PsiClient
PSI client for computing intersections
PsiServer
PSI server for encoding sets
PsiServerMessage
PSI server message containing encoded set elements

Enums§

PsiError

Type Aliases§

PsiResult