Skip to content
This repository was archived by the owner on Jan 28, 2026. It is now read-only.

Implements multihash set using Risretto #14

Merged
avichalp merged 5 commits intomainfrom
avichalp/ristretto
Nov 28, 2023
Merged

Implements multihash set using Risretto #14
avichalp merged 5 commits intomainfrom
avichalp/ristretto

Conversation

@avichalp
Copy link
Contributor

@avichalp avichalp commented Nov 5, 2023

  • Adds homomorphic hashing primitives that can be used to hash local database exports

@avichalp avichalp changed the base branch from main to next November 10, 2023 09:27

// MultisetHash is a multiset hash based on ECMH
// implementated using ristretto points.
type MultisetHash struct {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

basin set operations

require.NoError(t, err)
newItem = ristretto.Point{}
hashSet1.Insert(newItem.DeriveDalek(data2))

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

still pondering this question
cc: @carsonfarmer

@avichalp avichalp marked this pull request as ready for review November 15, 2023 12:41
Base automatically changed from next to main November 28, 2023 07:34
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>
Signed-off-by: avichalp <hi@avichalp.me>
@avichalp avichalp merged commit 4e78db3 into main Nov 28, 2023
@avichalp avichalp deleted the avichalp/ristretto branch November 28, 2023 07:48
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants