PERL and Blowfish

Posted on 2006-04-12
Last Modified: 2008-03-03

Recently I got a PERL program written that will encrypt file using Blowfish. I need some changes but am unable to
trace that person and I am not a PERL programmer. I am a VB.NET Programmer. I have installed PERL 5.8 from
and Crypt-Blowfish_PP.

Following are my queries:

a. The file has the following line:
use Crypt::Blowfish;
But the client wants to use Crypt-Blowfish_PP and that is what I have downloaded and insgtalled. Since I am running this under windows and the source is pure text, can I change the line to use Crypt::Blowfish_PP; using NotePad? Will this impact the encryption code written by the earlier programmer?

b. Also can I change the line:
 my $proc = new Crypt::Blowfish $key_valid;
my $proc = new Crypt::BlowfishPP $key_valid;

c. The source file has:
my $key = "My key"
Now this key is in pure text format. How can I encrypt this
key itself? Otherwise programmers who will use this
source file can see the key which is not good. In other
words, I need to put the encrypted key and then decrypt
it at run-time. If this is not possible, then can I compile
this file into an executable? If yes, how? or is there any third party tool that can convert my .pl file into an exe?

d. What is difference between Blowfish and Blowfish_PP? Will the output differ if I change Blowfish to Blowfish_PP?


Question by:vj_mi
    LVL 84

    Expert Comment

    the output should be identical if you just change Crypt::Blowfish to Crypt::Blowfish_PP
    Crypt::Blowfish_PP is implemented purely in Perl so it is more portable, while Crypt::Blowfish compiled in C so it is faster.
    You can get the key at run time.  
    LVL 4

    Accepted Solution

    a) According to the doc available at CPAN you can simply replace the use-call by the Crypt::Blowfish_PP one :)
    b) It's actually "my $blowfish=new Crypt::Blowfish_PP ($key);" ;)
    c) IMO you'd need a key to decrypt your crypted in-source key (which has to be supplied somehow.. eg. Add a prompt asking for the phrase on startup).
    d) PP = PurePerl.. Which means it doesn't have to be compiled using a compiler.. but is slower than the C implementation of blowfish used in Crypt::Blowfish.

    On a sidenote: You might wanna get Crypt::Blowfish (without the _PP) from activeperl's own repository.. Check ppm install Crypt_Blowfish (or something along the lines).
    ppm.bat is a helper tool for accessing the ActivePerl module repository from the command line.. It can be found at %ACTIVEPERLINSTALLATIONDIRECTORY%/bin/ppm.bat :)


    LVL 4

    Expert Comment

    Thanks for the points :)

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    What Should I Do With This Threat Intelligence?

    Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

    Suggested Solutions

    Many time we need to work with multiple files all together. If its windows system then we can use some GUI based editor to accomplish our task. But what if you are on putty or have only CLI(Command Line Interface) as an option to  edit your files. I…
    There are many situations when we need to display the data in sorted order. For example: Student details by name or by rank or by total marks etc. If you are working on data driven based projects then you will use sorting techniques very frequently.…
    Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
    This video is in connection to the article "The case of a missing mobile phone (". It will help one to understand clearly the steps to track a lost android phone.

    761 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    10 Experts available now in Live!

    Get 1:1 Help Now