This commit is contained in:
2021-09-10 15:36:31 +02:00
parent c1daba9595
commit 05647d4a8a

View File

@ -222,12 +222,12 @@ int verifyChecksumFromFile(char *mess, char *clientChecksum, char *fname, ssize_
char lastByte = buf[0]; char lastByte = buf[0];
// bytes = 128 // bytes = 128
while (bytes > 0) { while (bytes > 0) {
buf[0] = lastbyte; buf[0] = lastByte;
// 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);
} }
lastbyte = buf[bytes]; lastByte = buf[bytes];
if (!MD5_Update(&c, buf, bytes)) { if (!MD5_Update(&c, buf, bytes)) {
fclose(fp); fclose(fp);
strcpy(mess, "Unable to calculate checksum (MD5_Update)\n"); strcpy(mess, "Unable to calculate checksum (MD5_Update)\n");