Python Forum
How to decrypt Blowfish-encrypted text encrypted with Perl's Crypt::CBC?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to decrypt Blowfish-encrypted text encrypted with Perl's Crypt::CBC?
#1
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!
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  How to pass encrypted pass to pyodbc script tester_V 0 805 Jul-27-2023, 12:40 AM
Last Post: tester_V
  Encrypt and decrypt in python using own fixed key SriRajesh 3 4,626 Feb-20-2022, 01:18 PM
Last Post: dboxall123
  Trying to encrypt and decrypt password into a file rpizw 4 3,211 Aug-12-2020, 05:15 PM
Last Post: bowlofred
  Parse encrypted xml file to csv Mekala 2 2,174 May-30-2020, 12:23 AM
Last Post: Mekala
  The code to decrypt Caeser Cipher. lazerwolf101 2 3,082 May-26-2020, 04:01 PM
Last Post: DT2000
  Paul Rubin p3.py lightweight encrypt/decrypt - is there a python3 version? mason28 0 1,568 Feb-19-2020, 03:38 AM
Last Post: mason28
Question Difference between Python's os.system and Perl's system command Agile741 13 6,656 Dec-02-2019, 04:41 PM
Last Post: Agile741
  What crypt lib should be use in python? linh_py 3 2,392 Sep-17-2019, 02:56 AM
Last Post: wavic
  Need help understanding a couple of functions (encrypt,decrypt, int_to_bytes) xoani 0 1,968 Jun-09-2019, 03:25 PM
Last Post: xoani
  Simple inter-process communication: Switching from Perl to Python Pappy 1 2,861 May-10-2019, 12:29 AM
Last Post: Pappy

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020