int do_decrypt(const unsigned char *encrypter, int encrlen, unsigned char *decrypter)
{
int i;
int keylen;
unsigned char block_key[9];
unsigned char key[KEY_SIZE] = {0};
DES_key_schedule ks,ks2,ks3;
keylen = strlen(sessionid);
memcpy(key, (const unsigned char *)sessionid, keylen > KEY_SIZE ? KEY_SIZE : keylen);
memset(block_key, 0, sizeof(block_key));
memcpy(block_key, key + 0, 8);
DES_set_key_unchecked((const_DES_cblock*)block_key, &ks);
memcpy(block_key, key + 8, 8);
DES_set_key_unchecked((const_DES_cblock*)block_key, &ks2);
memcpy(block_key, key + 16, 8);
DES_set_key_unchecked((const_DES_cblock*)block_key, &ks3);
for(i = 0; i < encrlen/8; i++){
DES_ecb3_encrypt((const_DES_cblock*)(encrypter+8*i), (DES_cblock*)(decrypter+8*i), &ks, &ks2, &ks3, DES_DECRYPT);
}
return encrlen;
}