rmyorston / busybox-w32

WIN32 native port of BusyBox.
https://frippery.org/busybox
Other
670 stars 124 forks source link

Wrong SHAXXXSUM-test by applet, when the SHASUM is provided in UPPERCASE letters #394

Closed vitusb closed 1 month ago

vitusb commented 4 months ago

As far as i know, a SHA-hash is usually given as the hexadecimal representation of the calculated hash; since it’s a hexadecimal number, case doesn’t matter.

When using the sha256-applet of busybox in order to check against an uppercase SHA256-representation, i will get a mismatch !

C:\Temp >sha256sum -cw SHA256SUMS
Win11_23H2_German_x64v2.iso: OK

C:\Temp >type SHA256SUMS
9bd27fd71714d7458d88b537db74de115ce7585fcd78783ed38d96a544017b68 Win11_23H2_German_x64v2.iso

C:\Temp >sha256sum -cw SHA256SUMS.UPPERCASE
Win11_23H2_German_x64v2.iso: FAILED
sha256sum: WARNING: 1 of 1 computed checksums did NOT match

C:\Temp >type SHA256SUMS.UPPERCASE
9BD27FD71714D7458D88B537DB74DE115CE7585FCD78783ED38D96A544017B68 Win11_23H2_German_x64v2.iso
C

Best regards, vitusb

rmyorston commented 4 months ago

Confirmed. The same problem is present in upstream BusyBox.

The fix seems to be simple enough, just use a case-insensitive comparison. Fix to follow shortly.

rmyorston commented 4 months ago

This issue should be fixed in the latest prerelease binaries (PRE-5316 or above).

I've sent a patch upstream, but they may take a bit longer to respond ;-)

rmyorston commented 1 month ago

This change is available in the latest release (FRP-5398). It's also been accepted upstream.