Skip to content

feat(bloomfilter): add salt #742

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 13 commits into
base: main
Choose a base branch
from
Open

feat(bloomfilter): add salt #742

wants to merge 13 commits into from

Conversation

wenkokke
Copy link
Collaborator

This PR adds salt to the Bloom filter API.

I expect the CI to break, since I have not modified the usage of the bloomfilter package in lsm-tree.

Copy link
Collaborator

@dcoutts dcoutts left a comment

Choose a reason for hiding this comment

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

This is looking good so far.

A few minor suggestions:

  • arg order
  • do we really need a class for hashing with salt, it's just used internally
  • where the Salt type lives

And then we can move on to the uses in lsm-tree.

Comment on lines +95 to +104
update s (hashSalt64 salt x)

instance (Hashable a, Hashable b) => Hashable (a, b) where
hashSalt64 salt (x, y) = incrementalHash salt $ \s -> do
update s (hash64 x)
update s (hash64 y)
update s (hashSalt64 salt x)
update s (hashSalt64 salt y)
Copy link
Collaborator

Choose a reason for hiding this comment

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

You don't need to change these ones that use incrementalHash, because incrementalHash already uses the salt to initialise the (mutable) hash state.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, I was wondering about that.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Does it hurt, though?

@wenkokke wenkokke force-pushed the wenkokke/bloomfilter-salt branch from a0d8b27 to caeb000 Compare May 29, 2025 11:22
@wenkokke wenkokke force-pushed the wenkokke/bloomfilter-salt branch 3 times, most recently from 4752a95 to 35e8db0 Compare June 5, 2025 13:11
@wenkokke wenkokke force-pushed the wenkokke/bloomfilter-salt branch from 2fc1622 to f13d95b Compare June 6, 2025 13:05
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.

2 participants