Tyler Longren wrote: > > Hi Folks, Hello,
> The code at http://longren.no-ip.org/tyler/blowfish.pl encrypts some $data. > Once the data is encrypted, the hex value should be stored in $ciphertext. > $plaintext should have the original data that's in $data. > > When I run this code, I recieve this error: > "input must be 8 bytes long at > /usr/lib/perl5/site_perl/i386-linux/Crypt/Blowfish.pm line 56." > > Does anybody know why this happens? > > You can view the code here: > > #!/usr/bin/perl -w > use strict; > use Crypt::Blowfish; > my $key = pack("H16", "F0AA2pa8"); > my $cipher = new Crypt::Blowfish $key; > my $data = "54321"; > my $ciphertext = $cipher->encrypt($data); > my $plaintext = $cipher->decrypt($ciphertext); > print "Ciphertext: ", unpack("H16", $ciphertext), "\n"; > print "Plaintext: $plaintext\n"; > exit; According to the documentation for this module: NOTES The module is capable of being used with Crypt::CBC. You're encouraged to read the perldoc for Crypt::CBC if you intend to use this module for Cipher Block Chaining modes. In fact, if you have any intentions of encrypting more than eight bytes of data with this, or any other block cipher, you're going to need some type of block chaining help. Crypt::CBC tends to be very good at this. If ^^ you're not going to encrypt more than eight bytes, your data must be exactly ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ eight bytes long. If need be, do your own padding. "\0" as a null byte is ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ perfectly valid to use for this. Additionally, the current maintainer for ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Crypt::Blowfish may or may not release Crypt::CBC_R which replaces the default 'RandomIV' initialization vector in Crypt::CBC with a random initialization vector. (to the limits of /dev/urandom and associates) In either case, please email [EMAIL PROTECTED] for Crypt::CBC_R. Your data is only five bytes long. my $data = pack 'a8', '54321'; John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]