Skip to content

feat(hardware): introduce Perceptual Hash (pHash) for compression-resilient ZK verification#35

Open
Tenerife-Q wants to merge 2 commits intoc2siorg:mainfrom
Tenerife-Q:feat-phash-extraction
Open

feat(hardware): introduce Perceptual Hash (pHash) for compression-resilient ZK verification#35
Tenerife-Q wants to merge 2 commits intoc2siorg:mainfrom
Tenerife-Q:feat-phash-extraction

Conversation

@Tenerife-Q
Copy link
Copy Markdown

feat(hardware): add pHash to handle image compression

The current SHA256-based logic is a bit too "brittle"—even a tiny bit of compression during network transit breaks the entire ZK verification. To fix this, I’ve added Perceptual Hashing (pHash) support on the hardware side.

What I did:

  • Integrated imagehash and Pillow to generate a visual fingerprint of the photo at capture time.
  • Added a simple fallback (PHASH_AVAILABLE) so the app doesn't crash if these libraries aren't installed.
  • Injected the pHash into the upload metadata.

The Bigger Picture:
This is actually the first step for my GSoC 2026 proposal. My plan is to use this pHash inside a RISC Zero ZK circuit (using Rust) to calculate Hamming Distance. This way, the system can mathematically tolerate minor compression while still blocking AI-generated fakes.

This approach is inspired by my research on image forensics in the "Yuanjing" project. Excited to see this moving forward!
image
屏幕截图 2026-03-23 003235

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant