|
NAMECrypt::Ctr - Encrypt Data in Counter Mode SYNOPSIS use Crypt::Ctr;
my $cipher = new Crypt::Ctr $key, 'Crypt::Rijndael';
my $ciphertext = $cipher->encrypt($plaintext);
my $plaintext = $cipher->decrypt($ciphertext);
my $cipher2 = new Crypt::Ctr $key, 'Digest::MD5';
$ciphertext = $cipher->encrypt($plaintext);
$plaintext = $cipher->decrypt($ciphertext);
DESCRIPTIONGeneric Counter Mode implementation in pure Perl. The Counter Mode module constructs a stream cipher from a block cipher or cryptographic hash funtion and returns it as an object. Any block cipher in the "Crypt::" class can be used, as long as it supports the "blocksize" and "keysize" methods. Any hash function in the "Digest::" class can be used, as long as it supports the "add" method. NoteCounter mode produces the keystream independent from the input. Be sure not to re-use keys in Counter mode. As with Cipher Feedback mode, one should use Counter mode inside authenticated channels, e.g. HMAC. METHODS
BUGSThis is awfully slow. Some classes in "Digest::" do not provide the "add" method, so they will fail. The internal counter is a Perl integer. This could possibly lead to strange errors when encrypting more than "POSIX::LONG_MAX" bytes and decrypting it on a different architecture. AUTHORMatthias Bauer <matthiasb@acm.org>
|