Your new topic does not fit any of the above??? Check first. Then post here. Thanks.

Moderator: igrr

User avatar
By RichardS
#57704 In theory the Updater should work but from what I see you need to send it parameters like "client" which is network based....

I looked at updater.h and will try and use these functions....

Do I need to worry about MD5... how to know the file I updated with is valid?

RichardS
User avatar
By RichardS
#57706 ESP.getSketchMD5() gets the current running sketch MD5?

So once I load new sketch how to make sure MD5 of the file is equal to the MD5 of the new yet to be executed sketch in flash?

Also when I execute MD5Final (hash, &md5); it seems to crash the ESP

RichardS
User avatar
By martinayotte
#57712 I don't see any "client" refered in Updater.cpp ...

About MD5, it seems that if you never call Updater.setMD5, it won't check any, but if you provide one, calculated yourself from the file in SPIFFS, then it will verify it and will avoid replacing firmware if not matching.
User avatar
By RichardS
#57717 That's what I thought and it seems I can not make it fail, I want to use MD5, I calculate one...

Code: Select all md5_context_t md5;
int fileLen;
char buf[64];
char hash[64];

fileLen = f.size();
MD5Init (&md5);
while (fileLen > 0) {
  readLen = f.read(buf, 64);
  MD5Update (&md5, buf, readLen);
  fileLen -= readLen;
  yield();
}
MD5Final (hash, &md5);


What size MD5 so I expect?? is it in character format?

BUT

When I do call setMD5(hash) it never complains if its valid or not.... I never get MD5 error.... even if I pass it hash[0] = 0;

I expect to be able to force an error code 7, which is bad MD5.

RichardS