mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-23 10:07:59 +02:00
wip
This commit is contained in:
@ -266,7 +266,8 @@ int verifyChecksumFromFlash(char *mess, char *clientChecksum, char *fname,
|
|||||||
char buf[readUnitSize + 1];
|
char buf[readUnitSize + 1];
|
||||||
ssize_t bytes = fread(buf, 1, readUnitSize + 1, fp);
|
ssize_t bytes = fread(buf, 1, readUnitSize + 1, fp);
|
||||||
// the first time, extra bytes are read
|
// the first time, extra bytes are read
|
||||||
ssize_t totalBytesRead = bytes - 1;
|
--bytes;
|
||||||
|
ssize_t totalBytesRead = bytes;
|
||||||
char lastByte = buf[0];
|
char lastByte = buf[0];
|
||||||
int oldProgress = 0;
|
int oldProgress = 0;
|
||||||
|
|
||||||
@ -280,10 +281,24 @@ int verifyChecksumFromFlash(char *mess, char *clientChecksum, char *fname,
|
|||||||
}
|
}
|
||||||
|
|
||||||
buf[0] = lastByte;
|
buf[0] = lastByte;
|
||||||
|
if (totalBytesRead == bytes) {
|
||||||
|
printf("\n");
|
||||||
|
for (int i = 0; i < 10; ++i) {
|
||||||
|
printf("[0x%x] ", 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) {
|
||||||
|
printf("after the fix\n");
|
||||||
|
for (int i = 0; i < 10; ++i) {
|
||||||
|
printf("[0x%x] ", buf[i]);
|
||||||
|
}
|
||||||
|
printf("\n");
|
||||||
|
}
|
||||||
lastByte = buf[bytes];
|
lastByte = buf[bytes];
|
||||||
if (!MD5_Update(&c, buf, bytes)) {
|
if (!MD5_Update(&c, buf, bytes)) {
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
|
Reference in New Issue
Block a user