Crypt-Shark
view release on metacpan or search on metacpan
examples/cbc-mode view on Meta::CPAN
#!/usr/local/bin/perl
use diagnostics;
use strict;
use warnings;
use Crypt::CBC; # CBC automatically loads Shark for us
my $key = pack "H32", "00112233445566778899aabbccddeeff";
my $IV = pack "H16", "123456789abcdef0";
my $cipher = Crypt::CBC->new({'key' => $key,
'cipher' => 'Shark',
'iv' => $IV,
'regenerate_key' => 1,
'padding' => 'standard',
'prepend_iv' => 0
});
my $plaintext1 = pack "H16", "123456789abcdef";
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";
( run in 0.922 second using v1.01-cache-2.11-cpan-e1769b4cff6 )