Greetings, fellows.
I'm trying to do some basic operations using Crypt::Blowfish here, but I'm not getting it too good as I thought I would.
This module looks very simple to use, but I'm missing something here.
I was sucessfull to encrypt a string but can't decrypt it. I've followed the module documentation and did like this:
To encrypt:
#!c:/perl
use Crypt::Blowfish;
while ($pass = <>)
{
chomp $pass;
$key = pack ("H16","0123456789ABCDEF");
$cipher = new Crypt::Blowfish $key;
$ciphertext = $cipher->encrypt("$pass");
print unpack ("H16",$ciphertext),"\n";
}
and, to decrypt:
#!c:/perl
use Crypt::Blowfish;
while ($pass = <>)
{
chomp $pass;
$key = pack ("H16","0123456789ABCDEF");
$cipher = new Crypt::Blowfish $key;
$ciphertext = $cipher->decrypt("$pass");
print unpack ("H16",$ciphertext),"\n";
}
So, if I try to put the encrypted string for the module to decrypt it, it returns this:
"input must be 8 bytes long at C:/Perl/site/lib/Crypt/Blowfish.pm line 68, <> line 1"
Can anyone explain this to me? Why it doesn't works? If it must be 8 bytes long why does it generate a longer string?
Thanks in advance, brothers.
Er Galvão Abbott
a.k.a. Lobo, DaWolf
Webdeveloper
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.