Implements multihash set using Risretto #14
Conversation
avichalp
commented
Nov 5, 2023
- Adds homomorphic hashing primitives that can be used to hash local database exports
cd01ebd to
513c3c8
Compare
|
|
||
| // MultisetHash is a multiset hash based on ECMH | ||
| // implementated using ristretto points. | ||
| type MultisetHash struct { |
There was a problem hiding this comment.
implements the multihash as it is implemented here: https://github.com/tablelandnetwork/hhash/blob/main/src/lib.rs#L28
| } | ||
|
|
||
| // String returns the string representation of the multiset hash. | ||
| func (h *MultisetHash) String() string { |
There was a problem hiding this comment.
basin set operations
pkg/ecmh/ecmh_test.go
Outdated
| require.NoError(t, err) | ||
| newItem = ristretto.Point{} | ||
| hashSet1.Insert(newItem.DeriveDalek(data2)) | ||
|
|
There was a problem hiding this comment.
this test exports the parquet file, then reimports and verifiers the hash. this doesn't really belong in the ecmh package because it only deals with the set operations but we can move it later.
There was a problem hiding this comment.
Agree that this does not belong here, but I wonder what additional signal this test is adding. At the end of the day, this test is not much different than simply testing the insert order of simple strings. So, I have a hard time seeing the benefit of creating random data in a db file, just to check that simple fact. Maybe I'm missing something
There was a problem hiding this comment.
I can remove it now. I initially added to check if hashes work fine with parquet files.
| // NewMultisetHash creates a new multiset hash. | ||
| func NewMultisetHash() *MultisetHash { | ||
| p := ristretto.Point{} | ||
| // shoud we use SetZero() here? base is the generator |
There was a problem hiding this comment.
still pondering this question
cc: @carsonfarmer
8529074 to
17dae9c
Compare
Signed-off-by: avichalp <hi@avichalp.me>
Signed-off-by: avichalp <hi@avichalp.me>
Signed-off-by: avichalp <hi@avichalp.me>
Signed-off-by: avichalp <hi@avichalp.me>
17dae9c to
76d4ba2
Compare