Skip to content
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

[Foundation] Data: Hash the entire contents, not just an arbitrary subset #23876

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

lorentey
Copy link
Member

@lorentey lorentey commented Apr 9, 2019

This was cherry picked from commit b711ed9 in #23832. Data already implements hash(into:), so arguably this change doesn't belong in that PR anyway.

This is one case where the existing hashing implementation deliberately fails to feed all relevant information into the hasher. This makes it trivial to induce an arbitrary number of collisions, despite all the effort that went into implementing a high-quality universal hash function.

This seems like a particularly bad idea for Data, which is the standard type for safely exchanging byte buffers across module boundaries. It is reasonable to expect Data to implement the same high quality hashing as Array does; silently doing otherwise is not a good idea.

We previously discussed this issue in #21754.

@shahmishal
Copy link
Member

Please update the base branch to main by Oct 5th otherwise the pull request will be closed automatically.

  • How to change the base branch: (Link)
  • More detail about the branch update: (Link)

@lorentey lorentey changed the base branch from master to main October 1, 2020 19:07
@tbkka
Copy link
Contributor

tbkka commented Jun 15, 2022

Is this still relevant?

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.

3 participants