Link to home
Start Free TrialLog in
Avatar of blnukem
blnukem

asked on

String Encryption & Decryption

Hi all

I want to use Crypt::Blowfish to encrypt my cookies I cant seem to figure it out.

I want to encrypt:

$CookieName = "Some_Name_123";

$CookieValue = "Some_Value_123";

And then of course in need an example to decrypt them. I need a simple working sample.

ASKER CERTIFIED SOLUTION
Avatar of Adam314
Adam314

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of blnukem
blnukem

ASKER


Adam314

That doesn't seem to work for me.
What part of it doesn't work?  Do you get an error message?  Is the data just not correct?

It looks like there are some invalid characters in your original code, which i copied/pasted.  Did you remove them:
$CookieName = "Some_Name_123";
$CookieValue = "Some_Value_123";
Avatar of blnukem

ASKER


Adam314

Q: it looks like there are some invalid characters in your original code, which i copied/pasted.  Did you remove them:

A: Yes

I run the code as above and get ERROR: input must be 8 bytes long.
Your input ($CookieName, $CookieValue) must all be exactly 8 bytes long.

If you want to encrypt/decrypt data of arbitrary length, look at Crypt::CBC
http://search.cpan.org/~lds/Crypt-CBC-2.22/CBC.pm