0

I am unable to figure out why the following two files are yielding different hashes (SHA1, CRC32, SHA384, whatever):

https://cdn.jsdelivr.net/npm/jsonify-error@1.2.1/dist/jsonify-error.js

https://cdn.jsdelivr.net/npm/jsonify-error@1.2.2/dist/jsonify-error.js

I tried several diff utilities so far but all of them claim the files are identical.

I downloaded both files and checked them with Sublime Text 3 and Visual Studio Code, both seem to be UTF-8, CRLF, but as soon as I open the first and hit Ctrl+S on it (without changing anything!) its hash changes to be the same as the second one.

What is happening here?

EDIT to clarify: I want to know what is different between the files. I know it is something with whitespace characters or line endings, but what? Which line? Where? Which character?

2

Line 1 in v1.2.1 ended as linux EOL, while ver 1.2.2 on the same line has windows line ending.
(Linux use as line separator 0x0A character, while windows using 0x0D,0x0A)

The same with lines: 3, 4, 59, 60 and 61.

Tool used to spot the issue is WinMerge.

1

Look in a hex editor: one file uses 0x0a (LF) to mark end of line, the other uses 0x0d0a (CR/LF). Use a tool such as Notepad++ to change files to the same newline convention, if you must.

Hex view of 2 files

  • What caught me off guard is that it's not all lines, but only a few of them, right? Only lines 1, 3, 4, 59, 60 and 61, for some odd reason (as shown in the other answer) – Pedro A Aug 15 '18 at 23:49
  • Perhaps files were moved from one OS to another and edited there? – DrMoishe Pippik Aug 16 '18 at 0:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.