SLAA547C July 2013 – July 2021 MSP430FR5739
The following code example shows a hashing of a message using SHA-224. Although an array of eight 32-bit words are used for the hashing process, only the first seven 32-bit words are used as the hash result.
#include "msp430x26x.h"
#include "TI_SHA2.h"
uint32_t M[32]; //Message array to be hashed
uint64_t L = 0x0000000000000000; //Bit Length of message to be hashed
uint32_t Ha[8]; // Hash Array to be used during calculation and to store result
int main( void )
{
M[0] =0x41424344; //Data
M[1] =0x45464748; //Data
M[2] =0x494A4B4C; //Data
L = 0x0000000000000060 //Length == 96 bits or 0x60 bits
SHA_256(M, L, Ha, 0); // "0" indicates SHA-224 mode.
return 0;
}