Created on 19th May 2024
•
We designed a SNARK-friendly CPA-encryption scheme, based on the assumption of the pseudorandomness of the zk-friendly hash function Poseidon. However, our scheme uses the hash function in a black-box way and one could use another zk-friendly function, such as Reinforced Concrete.
We arrived independently at a scheme which is very similar to the one proposed by Aleph Zero in their docs. However, our scheme provides an optimization for the case of encrypting a single field element, halving the number of hash computations in this case.
Apart from the usecase suggested by Aleph Zero, our scheme could be used to implement yes/no voting in the following way:
The voter sends ct := Enc(k, vote) = H(k, nonce) + vote, and zk proof that the vote is well-formed
The voter anonymously reveals h := H(k, nonce) AND a zk proof that H(k, nonce) = ct xor vote
The aggregator sums the ciphertexts ct and subtracts the values h received from all participants
The optimal hash function for our design is Reinforced Concrete. However, there are few community implementations of halo2 gadgets for hash functions (that is, Poseidon and Sha256) and thus we would need to implement the gadget for Reinforced Concrete ourselves. However, it would be time-consuming and impossible to do it in the limited timeframe of the hackathon.
Another challenge was that we needed to learn halo2 in a very short time. It was difficult because it is a low-level technology and the documentation is very limited, and so are the official examples - the best way to learn halo2 was to attempt to understand the tests and the benchmarks.
Tracks Applied (1)
Aleph Zero
Technologies used
Cheering for a project means supporting a project you like with as little as 0.0025 ETH. Right now, you can Cheer using ETH on Arbitrum, Optimism and Base.