#!/usr/bin/perl use strict; use warnings; use Crypt::CBC; use Digest::MD5 qw/md5_hex/; my $password = $ARGV[0] || 1; my $cipher = Crypt::CBC->new(-key => md5_hex($password), -cipher => 'Rijndael'); print decrypt( encrypt('gfg') ); sub encrypt { my $plain = shift; #$plain must be a multiple of 16 (in bytes) my $crypted = $cipher->encrypt($plain); return $crypted; } sub decrypt { my $crypted = shift; my $plain = $cipher->decrypt($crypted); return $plain; }