in reply to Re^2: Decrypting BlowfishNET (was Re^11: line by line Encryption ...)
in thread line by line Encryption fun with Crypt::CBC and Rijndael? File Ownership issues?

Tried passing the key straight to Blowfish. It failed too.
use strict; use warnings; use Crypt::Blowfish qw( ); use Crypt::CBC qw( ); use List::MoreUtils qw( apply ); use MIME::Base64 qw( decode_base64 ); my $key = '...'; my $ctext = decode_base64('...'); my $cipher = Crypt::Blowfish->new($key); my $iv = substr($ctext, 0, $cipher->blocksize(), ''); my $cbc = Crypt::CBC->new( -cipher => $cipher, -header => 'none', -iv => $iv, ); binmode(STDOUT); print($cbc->decrypt($ctext));

Replies are listed 'Best First'.
Re^4: Decrypting BlowfishNET (try2)
by samip (Novice) on Aug 11, 2008 at 12:46 UTC
    Thank you for your help. I don't think there is a byte-ordering problem here. You are right about the padding, I am unsure as to how BlowfishSimple does it. I have tried a few things and am just not sure how I should proceed. Do you have any suggestions on what I could try?

    Thanks again.

      You are right about the padding, I am unsure as to how BlowfishSimple does it.

      It doesn't y. You do it in the Encrypt function you presented.

      I have tried a few things and am just not sure how I should proceed.

      Comparing the libraries and see where they differ.

        You are right about the padding, I am unsure as to how BlowfishSimple does it.

        It doesn't you do it in the Encrypt function you presented.

        The encrypt subroutine I pasted above was from from the BlowfishSimple class. It comes as part of the BlowfishNET download. I was comparing the libraries to see how the two encrypt and decrypt and I believe they pad differently. That is the reason I pasted the subroutine here. I thought I had mentioned it.

        As far using the BlowfishSimple library/class, it pretty much boils down to making the following calls:

        bfs = new BlowfishSimple(key); enc = bfs.Encrypt(plaintext);

        So, as you can see that is why I keep querying about how the padding is done in BlowfishSimple, because that is what I thought is different, but then, I am not sure.

        Thank you for your help.