DevToys-app / DevToys

A Swiss Army knife for developers.
https://devtoys.app/
MIT License
26.94k stars 1.45k forks source link

Invalid SHA256 checksum for file generated #373

Closed bkonetzny closed 2 years ago

bkonetzny commented 2 years ago

Description

The DevToys creates an invalid SHA256 for a file. On linux (sha256sum) and with windows (certUtil) this is correct.

Steps To Reproduce

Download https://www.safe-ev.de/global/downloads/transparenzsoftware-1.2.0.jar and open it up in the DevToys "Generator -> Checksum" tool. Set SHA256 as algorythm.

DevToys will report the following checksum, which is not correct: d92b78db1320e4ce7eb1e45a025e0204ff8a1180ebe52bd941950b88785f613f

Expected behavior

Correct SHA256 is calculated for this file, as do the following tools:

Windows 11:

C:\>certUtil -hashfile transparenzsoftware-1.2.0.jar SHA256
SHA256-Hash of transparenzsoftware-1.2.0.jar:
8daa03163ea78b3c9f5dd2f8ce8f78f4f7f3768204e664cb592a47505ed0e16d

Linux:

sha256sum transparenzsoftware-1.2.0.jar
8daa03163ea78b3c9f5dd2f8ce8f78f4f7f3768204e664cb592a47505ed0e16d  transparenzsoftware-1.2.0.jar

DevToys Version

Version 1.0.2.0 | X64 | RELEASE | b972462 | b972462

Relevant Assets/Logs

grafik

user334 commented 2 years ago

Not only SHA256 I've used DevToys to check an iso image today and it constantly gives me a wrong hash for a file. After all the rechecks for my files I've tried another tools for calculating hashes and found out that my files were ok all this time. Some examples:

  1. I have an Windows ISO image which has a SHA-1 hash c1abfd48bb6e3a8391b14b50dd3130a25514622a which confirms by HashTab tool and builtin Windows' certUtil but DevTools gives me hash 5fa23f8eaeef38c2759ba169211e9420a543507a
  2. The installer for the HashTab app itself has an md5 hash 0A401AEC90A0B4F4DA73B4131F24EDA1 which is provided by the author and can be checked by the HashTab again and the certUtil. But DevToys gives me hash 285e6f827437170f5d1af47030bfd2cc. The installer is publicly awaliable by the link above so you can check by yourself
  3. File 64360VelerSoftware.DevToys_1.0.2.0_neutral___j80j2txgjg9dj.Msixbundle has md5 90c7746a301bfac288c5cf1ddf3e2630 but DevToys gives 0bf002bcb836fd4e078556f8454ce0f3

But it's not the case for all the files. For some of them the checksum calculation is correct. Screenshot from the 1-st comment here has md5 25b7e6cb4ce8af60d657750165c9c7c5 and DevToys calculates it correctly.

I have the version from the Microsoft Store: 1.0.2.0 | X64 | RELEASE | b972462 | b97246

Screenshot_2 Screenshot_3 Screenshot_4 Screenshot_5 2

a-khanna commented 2 years ago

I have created a PR with the fix. 👆 @bkonetzny the SHA256 for the given link was ecabb8b29eaa6a3e51c8491f43ce4a112dacdc74016e2129804aa368fdc0faf5. Maybe it's a different file than what you tested on. But anyway, the output should now consistent with certutil.

bkonetzny commented 2 years ago

@a-khanna you are right, the file got updated in the meantime.