This commit is contained in:
2021-09-10 17:06:27 +02:00
parent be4dfcf499
commit 2622f461e3

View File

@ -281,23 +281,19 @@ int verifyChecksumFromFlash(char *mess, char *clientChecksum, char *fname,
} }
buf[0] = lastByte; buf[0] = lastByte;
if (totalBytesRead == bytes) { if (totalBytesRead == 2 * bytes) {
printf("\n"); for (int i = 0; i < 26; ++i) {
for (int i = 16; i < 26; ++i) { printf("i:[0x%02x]\n", i, (uint8_t)buf[i]);
printf("[0x%02x] ", buf[i]);
} }
printf("\n");
} }
// shift by 4 bits to the left // shift by 4 bits to the left
for (int i = 0; i < bytes; ++i) { for (int i = 0; i < bytes; ++i) {
buf[i] = ((buf[i] & 0xf) << 4) + ((buf[i + 1] >> 4) & 0xf); buf[i] = ((buf[i] & 0xf) << 4) + ((buf[i + 1] >> 4) & 0xf);
} }
if (totalBytesRead == bytes) { if (totalBytesRead == 2 * bytes) {
printf("after the fix\n"); for (int i = 0; i < 26; ++i) {
for (int i = 16; i < 26; ++i) { printf("i:[0x%02x]\n", i, (uint8_t)buf[i]);
printf("[0x%02x] ", buf[i]);
} }
printf("\n");
} }
lastByte = buf[bytes]; lastByte = buf[bytes];
if (!MD5_Update(&c, buf, bytes)) { if (!MD5_Update(&c, buf, bytes)) {