[git commit] md5/shaXsum: accept uppercase hex strings

Denys Vlasenko vda.linux at googlemail.com
Thu Jul 11 16:17:31 UTC 2024


commit: https://git.busybox.net/busybox/commit/?id=a3c50683069c797ef328f6e32c6282d5d3243c98
branch: https://git.busybox.net/busybox/commit/?id=refs/heads/master

The coreutils versions of md5sum and the like accept uppercase hex
strings from checksum files specified with the '-c' option.

Use a case-insensitive comparison so BusyBox does the same.

Signed-off-by: Ron Yorston <rmy at pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux at googlemail.com>
---
 coreutils/md5_sha1_sum.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/coreutils/md5_sha1_sum.c b/coreutils/md5_sha1_sum.c
index f6a21237d..978d328f1 100644
--- a/coreutils/md5_sha1_sum.c
+++ b/coreutils/md5_sha1_sum.c
@@ -320,7 +320,7 @@ int md5_sha1_sum_main(int argc UNUSED_PARAM, char **argv)
 
 				hash_value = hash_file(in_buf, filename_ptr, sha3_width);
 
-				if (hash_value && (strcmp((char*)hash_value, line) == 0)) {
+				if (hash_value && (strcasecmp((char*)hash_value, line) == 0)) {
 					if (!(flags & FLAG_SILENT))
 						printf("%s: OK\n", filename_ptr);
 				} else {


More information about the busybox-cvs mailing list