Skip to content
This repository was archived by the owner on Aug 5, 2025. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
9 changes: 9 additions & 0 deletions crates/shielder-anonymity-revoking/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[package]
name = "shielder-anonymity-revoking"
version = "0.1.0"
edition = "2021"
license = "GPL-3.0-only"

[dependencies]
halo2_proofs = { workspace = true }
shielder-circuits = { workspace = true, features = ["multithreading"] }
2 changes: 2 additions & 0 deletions crates/shielder-anonymity-revoking/ids.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
9440169395504754245470329615876831200230604377098978722048854145612119242765
5237134896071455714741500253419101467831428387679124152860392967629378498801
48 changes: 48 additions & 0 deletions crates/shielder-anonymity-revoking/src/main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
use std::{
fs::File,
io::{BufRead, BufReader},
};

use halo2_proofs::halo2curves::{bn256::Fr, ff::PrimeField};
use shielder_circuits::poseidon::off_circuit::padded_hash;

fn find_id(id_hiding: Fr) {
let file = File::open("ids.csv").unwrap();
let reader = BufReader::new(file);
for id in reader.lines() {
println!("Checking id {:?}", id);
let id = id.unwrap();
let id = Fr::from_str_vartime(&id).unwrap();
let salt = is_hashed_id(id_hiding, id);
if let Some(salt) = salt {
println!("id {:?} id_hiding {:?} salt {:?} ", id, id_hiding, salt);
return;
}
}
println!("id for id_hiding {:?} not found", id_hiding);
}

fn is_hashed_id(id_hiding: Fr, id: Fr) -> Option<Fr> {
let mut salt = Fr::zero();
for _ in 0..65536 {
let hash = padded_hash(&[id, salt]);

if hash == id_hiding {
return Some(salt);
}

salt += Fr::one();
}
None
}

fn main() {
let file = File::open("transactions.csv").unwrap();
let reader = BufReader::new(file);

for id_hiding in reader.lines() {
let id_hiding = id_hiding.unwrap();
let id_hiding = Fr::from_str_vartime(&id_hiding).unwrap();
find_id(id_hiding);
}
}
1 change: 1 addition & 0 deletions crates/shielder-anonymity-revoking/transactions.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
16328282509914705445362040398690577023379464772216410028300930207352495880431