SLAA547C July 2013 – July 2021 MSP430FR5739
The following code example shows how to set the key schedule for DES encryption or decryption rounds. This step must be performed before encryption or decryption can begin.
#include "msp430xxxx.h"
#include "TI_DES.h"
int main( void )
{ des_ctx dc1; // Key schedule structure
des_ctx dc2; // Key schedule structure
unsigned char key[8] = {0x01,0x23,0x45,0x67,0x89,0xab,0xcd, 0xfe};
Des_Key(&dc1, key, EN0 ); // Sets up key schedule for Encryption only
Des_Key(&dc1, key, DE1 ); // Sets up key schedule for Decryption only
Des_Key(&dc2, key, ENDE ); // Sets up key schedule for Encryption and Decryption
return 0;
}