#!/usr/bin/perl use strict; use warnings; use Crypt::Rijndael; use Digest::MD5 qw/md5_hex/; my $password = $ARGV[0] || 1; my $cipher = Crypt::Rijndael->new(md5_hex($password), Crypt::Rijndael::MODE_CBC() ); print decrypt( encrypt('testtesttesttest') ); 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; }