From 75e1ade22f69abc2cf3aa18217617c985abc04d5 Mon Sep 17 00:00:00 2001 From: Will Miles Date: Sun, 22 Mar 2026 08:36:06 -0400 Subject: [PATCH] Use correct fix for SHA256 hash string @coderabbitai caught the problem, but its fix suggestion was out to lunch on this one. Passing an unsigned char to String.concat() appends it as a number instead of appending the character. Instead, mask the unneceeded bits. --- wled00/ota_update.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/wled00/ota_update.cpp b/wled00/ota_update.cpp index 904a242b..25fac1de 100644 --- a/wled00/ota_update.cpp +++ b/wled00/ota_update.cpp @@ -453,9 +453,9 @@ String getBootloaderSHA256Hex() { String result; result.reserve(65); for (int i = 0; i < 32; i++) { - unsigned char b1 = bootloaderSHA256Cache[i]; - unsigned char b2 = b1 >> 4; // bugfix: right-shift on signed char is undefined behaviour - b1 &= 0x0F; + char b1 = bootloaderSHA256Cache[i]; + char b2 = b1 >> 4; + b1 &= 0x0F; b2 &= 0x0F; // drop unneeded bits, including possible junk from arithmetic right shift b1 += '0'; b2 += '0'; if (b1 > '9') b1 += 39; if (b2 > '9') b2 += 39;