/***** Define the key for Blowfish encryption algorithm *****/
char key[SLC_BLOWFISH_DEFAULTKEYSIZE] =
{
'v','e','r','y','l','o','n','g',
'p','a','s','s','w','o','r','d',
'0','1','2','3','4','5','6','7',
'9','8','7','7','7','2','2','1',
'0','0','0','1','1','2','2','2',
'2','3','5','6','5','6','3','3',
'2','2','1','1','1','7','7','7'
};
/***** Define the block for Blowfish encryption algorithm ***/
unsigned char block[SLC_BLOWFISH_BLOCKSIZE] =
{
0x8C, 0x5B, 0x3C, 0x42, 0xDE, 0xB1, 0x11, 0xA0
};
/***** Initialize context ******************************/
unsigned char context[SLC_BLOWFISH_CONTEXTSIZE];
SL_BLOWFISH_Init( context, SLC_ENCRYPT, key, SLC_BLOWFISH_DEFAULTKEYSIZE );
/***** Encrypt the block *******************************/
SL_BLOWFISH_ProcessBlock( context, block, block ); /* in-place encryption */
/***** Change context direction to perform decryption **/
SL_BLOWFISH_Init( context, SLC_DECRYPT, key, SLC_BLOWFISH_DEFAULTKEYSIZE );
/***** Decrypt the block *******************************/
SL_BLOWFISH_ProcessBlock( context, block, block ); /* in-place decryption */
|