#!/usr/local/bin/perl
use strict;
use Crypt::CBC; # CBC automatically loads Khazad for us
my $key = pack "H32", "00112233445566778899aabbccddeeff";
my $IV = pack "H16", "0102030405060708";
my $cipher = Crypt::CBC->new({'key' => $key,
'cipher' => 'Khazad',
'iv' => $IV,
'regenerate_key' => 0,
'padding' => 'standard',
'prepend_iv' => 0
});
my $plaintext1 = pack "H32", "0123456789abcdeffedcba9876543210";
print "plaintext1 : ", unpack("H*", $plaintext1), "\n";
my $ciphertext1 = $cipher->encrypt($plaintext1);
print "ciphertext1 : ", unpack("H*", $ciphertext1), "\n";
my $plaintext2 = $cipher->decrypt($ciphertext1);
print "plaintext2 : ", unpack("H*", $plaintext2), "\n";