QuickCrypt Library API

SL_GOST_ProcessBlock

void SL_CRYPTCALL SL_GOST_ProcessBlock( const void* pContext, void* pDestBlock, const void* pSrcBlock );
 

Parameters

 pContext

    [in] Pointer to the context.

 pDestBlock

    [out] Pointer to the memory block that will receive the result of encryption/decryption. 

 pSrcBlock

    [in] Pointer to the memory block that has to be encrypted/decrypted.

Remarks

Call this function to encrypt/decrypt the first SLC_GOST_BLOCKSIZE bytes of the memory block pointed by pSrcBlock. The result is retrieved in the memory block pointed by pDestBlock.

To perform an in-place encryption/decryption, make pDestBlock equal to pSrcBlock.

Example

/***** Define the key for GOST encryption algorithm *****/
char key[SLC_GOST_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'
};

/***** Define the block for GOST encryption algorithm ***/
unsigned char block[SLC_GOST_BLOCKSIZE] = 
{
    0x8C, 0x5B, 0x3C, 0x42, 0xDE, 0xB1, 0x11, 0xA0
};

/***** Initialize context ******************************/
unsigned char context[SLC_GOST_CONTEXTSIZE];

SL_GOST_Init( context, SLC_ENCRYPT, key, SLC_GOST_DEFAULTKEYSIZE );

/***** Encrypt the block *******************************/
SL_GOST_ProcessBlock( context, block, block ); /* in-place encryption */

/***** Change context direction to perform decryption **/
SL_GOST_Init( context, SLC_DECRYPT, key, SLC_GOST_DEFAULTKEYSIZE );

/***** Decrypt the block *******************************/
SL_GOST_ProcessBlock( context, block, block ); /* in-place decryption */

 

 

GOST API Overview   |   GOST Functions   |   Useful Links

 

See Also    SL_GOST_Init


 

 

Send Feedback to SlavaSoft Inc. Tell a friend about QuickCrypt Library