Will take a look. Is that md5 for uploaded files/spiffs files?
For uploaded scketch for OTA, but you could use it for hash every file you upload.
Ah ok. I've got all that sorted. I'm trying to hash the actual sketch. The running one.
Well I've done it. And it works.
That way u can compare an incoming binary to the running one without having to specify versions and defines, and commit hashes and all sorts that gets complicated.
I just need to verify and change on thing. And check this sketch size issue. As the sketch size needs to return the same size as the binary on the computer. Not the aligned one. As the hash function needs this same size.
If that makes sense.
So far from all the sketches I've tested they are either 0,4,8,12 bytes larger than the current getsketchsize()
Me No Dev
what is common in the sizes (look at them in hex)
it is surely rounding up the size to some common denominator (like 16 bytes or 0xF)
so if the hex of the incomming size in bytes always ends on 0, the formula above should give you the size you are looking for
pos being equal to getsketchsize()
Actually, just rounding the size is not what he needs.
The correct formula is result=(pos+16)&15
Because there is a checksum byte added at the end
Just rounding the sketch size up to 16 bytes will not give a correct result when pos is already 16 bytes aligned, I.e. you need to take checksum byte into account.
P.s. I can send you a sketch which is 16 bytes larger than get sketch size 😉