Message388270
I have not gone to the extent of comparing the direct output against what python gets, although it appears to be incomplete. The following is my encrypt function which has been used successfully for many years in a separate c program, so I have high confidence in it.
char * encryptBlowfishCfb(const char * inStr, Py_ssize_t *count, char * output, char * encrkey) {
MCRYPT td;
char IV[10];
int len, i;
char block_buffer[512];
time_t t;
srand((unsigned) time(&t));
strcpy(IV, "");
for (i = 0 ; i < 8 ; i++ ) {
IV[i] = mset[(rand() % 62)];
}
td = mcrypt_module_open(MCRYPT_BLOWFISH, NULL, MCRYPT_CFB, NULL);
mcrypt_generic_init(td, encrkey, strlen(encrkey), IV);
memset(block_buffer, 0, sizeof(block_buffer));
strcpy(block_buffer, inStr);
i = strlen(inStr);
mcrypt_generic(td, &block_buffer, i);
block_buffer[i] = '\0';
strcpy(&block_buffer[i], IV);
mcrypt_generic_deinit(td);
mcrypt_module_close(td);
len = i + 8 + 1;
memset(output, 0, 512);
strncpy(output, block_buffer, len -1);
*count = i + 8;
return output;
} |
|
Date |
User |
Action |
Args |
2021-03-08 16:00:00 | dwoodjunkmail | set | recipients:
+ dwoodjunkmail, christian.heimes |
2021-03-08 16:00:00 | dwoodjunkmail | set | messageid: <1615219200.65.0.760521127878.issue43435@roundup.psfhosted.org> |
2021-03-08 16:00:00 | dwoodjunkmail | link | issue43435 messages |
2021-03-08 16:00:00 | dwoodjunkmail | create | |
|