#!/usr/bin/perl -w use strict; use Crypt::DES; my $key = pack("H16", "hello"); my $cipher = new Crypt::DES $key; for (my $i=1;$i<11;$i++){ my $ciphertext = $cipher->encrypt(&pad($i)); print "ciphertext: ".unpack("H16", $ciphertext); print " plaintext : ".$cipher->decrypt($ciphertext)."\n"; } sub pad { my $padstr = shift; my $padlen = length($padstr); for (my $i=$padlen;$i<8;$i++) { $padstr = '#'.$padstr; } return $padstr; }