On Sat, 04 Jan 2003 17:32:22 -0500, [EMAIL PROTECTED] (Mark Goland)
wrote:

>no, I want to use one of Crypt modules which expacts to be passed strings of
>n*16 bytes. How do I go about genereting such blocks ??



#this sub makes all data blocksize of 16 bytes.
sub get16 {
    my $data = shift;
    print "data=$data\n";
      return "\0" x ( 16 - length($data)%16 ) . $data;
      }
      
exit;

#You can also use this to get data that is in a multiple of 16 bytes:
# this requires $username < 16 bytes and prefix packs with spaces
#    sprintf '%16s', $username;
#or you can xor it
# $filecrypted = $cipher->encrypt($file^("\0"x16));

#To strip any padding after decryption:
#my $plaintext = $cipher->decrypt($secret_stuff);
#   $plaintext =~ s/^\0+//;  
# remove leading null bytes, use \s (not \0) for spaces
      

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to