Skip to content

Hash collision with hash-sum package #132

Open
@kentahama

Description

@kentahama

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions