***** infoCopter.com/perl *****

Crypt::Blowfish

Blowfish was designed in 1993 by Bruce Schneier as a fast, free alternative to existing encryption algorithms.

[ perl corner ] > [ Cryptography ] > [ Blowfish ] > [ more... ]

The key size can range from 32 bits (4 characters) to 448 bits (56 characters).

use Crypt::Blowfish;

my $key = pack("H16", "0123456789ABCDEF");  # min. 8 bytes

my $cipher = new Crypt::Blowfish $key;

my $ciphertext = $cipher->encrypt("plaintex");  # SEE NOTES

print unpack("H16", $ciphertext), "\n";


#####  Decrypt:

my $plaintext = $cipher->decrypt($ciphertext);

print "plaintext = '$plaintext'\n";

Demo

encrypt - decrypt

Input String: Is HEX

Secret Key: (At least 8 Bytes)



[ Example in PHP ]

© reto :)