当前位置: 技术问答>linux和unix
郁闷啊,这个函数不知道怎么调用!!
来源: 互联网 发布时间:2016-12-12
本文导语: //************ 3DES CBC (Cipher Block Chaining) mode encryption ************** #define KEY_LENGTH_DES (64) #define KEY_LENGTH_EXTENDED_DES (128*8) VOID Encrypt( unsigned int *IVector, unsigned int *KeyAddress, ...
//************ 3DES CBC (Cipher Block Chaining) mode encryption **************
#define KEY_LENGTH_DES (64)
#define KEY_LENGTH_EXTENDED_DES (128*8)
VOID
Encrypt( unsigned int *IVector,
unsigned int *KeyAddress, //密钥
unsigned int *SrcBuffer, //明文
unsigned int *DstBuffer, //密文
unsigned int Length ) // in bytes
{unsigned int i;
unsigned int buffer[2];
buffer[0] = IVector[0];
buffer[1] = IVector[1];
for(i = 0; i > 2); i = i+2)
{
// do EBC encryption of (Initial_Vector XOR Data)
buffer[0] ^= SrcBuffer[i];
buffer[1] ^= SrcBuffer[i+1];
DES3_ECB_mode( (BYTE *)buffer, (BYTE *)buffer,
KeyAddress, DES_ECB_ENCRYPT );
DstBuffer[i] = buffer[0];
DstBuffer[i+1] = buffer[1];
}
}
//*********** 3DES Key Extension **************
BOOL
KeyExtend( unsigned char* KeySource,
unsigned int* KeyDestination )
{
int i;
for(i=0; i