#!/usr/local/bin/perl use warnings; use strict; use Crypt::CBC; use Crypt::DES; # give compile-time error if uninstalled use Digest::MD5 qw/md5/; die "$0: Gimme a password in environment variable PASSWD\n" unless exists $ENV{PASSWD}; my $cr = new Crypt::CBC ({ key => $ENV{PASSWD}, cipher => 'DES', }); $cr->start('encrypting'); my $hdr = <<'END_HEADER'; #!/usr/local/bin/perl use warnings; use strict; use Crypt::CBC; use Crypt::DES; # give compile-time error if uninstalled use Digest::MD5 qw/md5/; my $cr = new Crypt::CBC ({ key => $ENV{PASSWD}, cipher => 'DES', }); $cr->start('decrypting'); eval join '', (map {$cr->crypt(unpack 'u',$_)} ), $cr->finish; __END__ END_HEADER $hdr =~ s/^ {4}//mg; print $hdr; while (<>) { print pack 'u', $cr->crypt($_); } print pack 'u', $cr->finish;