views:

243

answers:

1

I am making an IRC bot in php to read content of a channel. Bot is done fine.But the messages are encrypted With blowfish encryption. i have the key and all, i tried PHP's code below but didn;t worked.

echo mcrypt_decrypt(MCRYPT_BLOWFISH,$key,$input,MCRYPT_MODE_ECB);

For more help the encryption is done via drftpd site bot.

I can find this link http://trac.drftpd.org/browser/branches/jpf/src/plugins/org.drftpd.plugins.sitebot/src/org/drftpd/plugins/sitebot/OutputWriter.java?rev=1721

Written in Java so may be some Java guy can help too .

+2  A: 

I looked at org.drftpd.util.Blowfish and it: 1) uses ECB, and 2) uses getBytes() without specifying a charset, both of which are not recommended. It also base64 encodes after encrypting and base64 decodes prior to decrypting, so you'll need to do the same in your PHP code. It also does its own padding with 0 bytes, another thing you'll have to do yourself.

GregS