$cipher->encrypt($data) Encrypt data. The size of $data must be a multiple of blocksize (16 bytes), otherwise this function will croak. Apart from that, it can be of (almost) any length. #### # this requires $username < 16 bytes and prefix packs with spaces sprintf '%16s', $username; # this will give you a data length divisible by 16 for any length # we use null byte prefix packing sub get16 { my $data = shift; return "\0" x ( 16 - length($data)%16 ) . $data; }