How to get the offset address of a file created in SPIFFS partition
Posted: Wed Nov 08, 2023 12:24 pm
by saicharan67
Hi all,
I am trying to find the sha256 of a binary file situated at
using
but it requires the address of the file offset. Is there any way I can get the address of the file?
Thanks in advance
Re: How to get the offset address of a file created in SPIFFS partition
Posted: Wed Nov 08, 2023 9:31 pm
by ESP_adokitkat
Hello.
The `bootloader_sha256_flash_contents` function is to be used with flash memory and partitions on certain offsets, not with files. There is "mbedtls" component available in esp-idf in which there are functions you can call to get sha256 from a file, i.e. in "mbedtls/sha256.h".
Here is a code example:
https://stackoverflow.com/a/63691861
Docs:
https://mbed-tls.readthedocs.io/project ... sha256_8h/
https://docs.espressif.com/projects/esp ... edtls.html
Re: How to get the offset address of a file created in SPIFFS partition
Posted: Thu Nov 09, 2023 12:27 pm
by saicharan67
Hi thanks for the information, i have tried using the mbedtls apis for calculating the hash, but the hash generated for the file using mbedtls apis and hash generated from passing the same file to esp secure script with no signature appending and no padding are different.
Any insights what might be the case here?