I'm making some perl script (not for eggdrop) and it needs the same encryption as an eggdrop (encrypt <key> <string> / decrypt <key> <encrypted-base64-string>)
As I can read in the docs, eggdrop encrypts the string via blowfish first (since that's the encryption module I've loaded), and next encodes it in a base64 String.
However, when I try this in my perl script I don't get the same result (endoding or decoding)
I know this is not a perl forum, but this is the perl I have:
Code: Select all
my $key = "my key";
my $cipher = new Crypt::Blowfish $key;
# encryption:
my $ciphertext = $cipher->encrypt("a_string"); #encrypt with blowfish
my $in = encode_base64($ciphertext); # encode with base64
# $in should be the encrypted base64 string now ...
# decryption:
my $out = decode_base64($in); # decoding base64
my $plaintext = $cipher->decrypt($out); # decrypting blowfish