2025-10-31 12:53 PM
I try to understand in details the way the Hash peripheral works on the STM32L552. I need to make the HASH SHA-256 with 224 blocks of 512 bits. The Hash works perfectly until the block 223. Then I enter 16 values in the FIFO (in my code below I have a loop for 15 because I entered previously another value). Then I launch the final digest. I expect the automatic digest of block 224 and the automatic padding in a block 225 to the final hash value. But I always have the wrong value in the final step. Any idea about what I'm missing?
Solved! Go to Solution.
2025-11-18 3:10 AM
I reply to my own problem. I did not have the same result on the STM32 and the Hashlib from python because I made a mistake about the endianness of the padding. The hash processor is little endian and the position of the '1' for the padding was placed as big endian in my experiment. Once I corrected the endianness, all the calculations are correct.
2025-11-18 3:10 AM
I reply to my own problem. I did not have the same result on the STM32 and the Hashlib from python because I made a mistake about the endianness of the padding. The hash processor is little endian and the position of the '1' for the padding was placed as big endian in my experiment. Once I corrected the endianness, all the calculations are correct.