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

Hash collision with hash-sum package #132

Open
kentahama opened this issue Mar 16, 2023 · 0 comments
Open

Hash collision with hash-sum package #132

kentahama opened this issue Mar 16, 2023 · 0 comments

Comments

@kentahama
Copy link

kentahama commented Mar 16, 2023

Version

3.3.0

Explanation

I have found two different files that has the same hash value on following lines:

const cacheKey = hash(
filename + source + JSON.stringify(compilerParseOptions)
)

As a result, parse returns wrong cache for these files, which can cause builds to fail randomly or produce unexpected results. As mentioned in bevacqua/hash-sum#4, hash-sum algorithm is not suitable for content hashing. Unfortunately, I cannot share these private files here, but this issue may arise in projects with more than 10,000 files.
Would it be possible to switch to a more promising hash function, such as xxhash?

Related issue

vitejs/vite#912

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

No branches or pull requests

1 participant