cambrian / accumulator

Cryptographic accumulators in Rust.
https://cambrian.github.io/accumulator
MIT License
133 stars 34 forks source link

Generalize Accumulator, VectorCommitment over types that implement Hash #33

Closed eddiew closed 5 years ago

eddiew commented 5 years ago

For example, we can generalize Accumulator<G: UnknownOrderGroup> to Accumulator<T: Hash, G: UnknownOrderGroup>

and add goes from fn add(self, elems: &[Integer]) -> (Self, MembershipProof<G>) to fn add(self, elems: &[T]) -> (Self, MembershipProof<T, G>)

The type parameter T in the accumulator struct would be a phantom type to help prevent mixing accumulators for different element types

whaatt commented 5 years ago

I think this is overall a good idea -- one thing to consider though is that if hash_to_prime is a bottleneck, people might want to cache its Integer results for use with the accumulator functions.

Granted, hard to say if people will be doing that in practice...