hash-files
hash-files copied to clipboard
Concatenating files can generate same hash?
As far as I understand, this works by concatenating all of the files together and then hashing the result. Does this mean that we can get the same hash when hashing this:
File 1: 00 01 02 File 2: 03 04 05
As well as this?
File 1: 00 01 02 03 File 2: 04 05
That's true, thanks for uncovering this issue. I'll get this fixed soon.
Oh, just another thing to note, I'm not sure how important this is to you, but this hashing algorithm also doesn't seem to factor in the names of the files. So if a file got renamed from a.js
to aa.js
, the hash would still come out the same.
To solve both the issues at once, it would be enough to concatenate the full path of the file to the file data, and then hash.
I would create a PR, but I suppose this project is abandoned.