This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author dwoodjunkmail
Recipients christian.heimes, dwoodjunkmail
Date 2021-03-08.16:00:00
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1615219200.65.0.760521127878.issue43435@roundup.psfhosted.org>
In-reply-to
Content
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;
}
History
Date User Action Args
2021-03-08 16:00:00dwoodjunkmailsetrecipients: + dwoodjunkmail, christian.heimes
2021-03-08 16:00:00dwoodjunkmailsetmessageid: <1615219200.65.0.760521127878.issue43435@roundup.psfhosted.org>
2021-03-08 16:00:00dwoodjunkmaillinkissue43435 messages
2021-03-08 16:00:00dwoodjunkmailcreate