Python Forum
How to decrypt Blowfish-encrypted text encrypted with Perl's Crypt::CBC? - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: How to decrypt Blowfish-encrypted text encrypted with Perl's Crypt::CBC? (/thread-20518.html)



How to decrypt Blowfish-encrypted text encrypted with Perl's Crypt::CBC? - swechsler - Aug-15-2019

I've been a Perl writer for 20 years, and I'm just getting started with Python. I have a text file with some fields that were encrypted using Perl's Crypt::CBC and stored as hex. Here's how I currently decrypt it in Perl:

Output:
use Crypt::CBC; my $text = <encrypted hex string>; my $cipher_type = 'Blowfish'; my $encrypt_key = <my 64 byte key>; my $cipher = Crypt::CBC->new(-key => $encrypt_key, -cipher => $cipher_type); my $decoded_text = $cipher->decrypt_hex($text);
No salt was specified during the encryption. I want to be able to decrypt the hex string from within a Python script. Converting from hex to a string is straightforward enough, but apparently Blowfish is restricted to <= 56-byte keys, which leaves me really confused (I'm unclear as to how the Perl Blowfish decryption is using those 64 bytes, and how to do the same in Python). Help!