FreeBSD Manual Pages
CFB(3) User Contributed Perl Documentation CFB(3) NAME Crypt::CFB - Encrypt Data in Cipher Feedback Mode SYNOPSIS use Crypt::CFB; my $cipher = new Crypt::CFB $key, 'Crypt::Rijndael'; ## Or: my $iv = ''; map { $iv .= chr(rand(256)) } (0..16); my $cipher = new Crypt::CFB $key, 'Crypt::Rijndael', $iv; my $ciphertext = $cipher->encrypt($plaintext); my $plaintext = $cipher->decrypt($ciphertext); my $cipher2 = new Crypt::CFB $key, 'Digest::MD5'; $ciphertext = $cipher->encrypt($plaintext); $plaintext = $cipher->decrypt($ciphertext); DESCRIPTION Generic CFB implementation in pure Perl. The Cipher Feedback 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. METHODS "$cipher = new Crypt::CFB $key, $algorithm, $optional_iv" Constructs a CFB object. If $algorithm is a block cipher, then $key should be of the correct size for that cipher. In most cases you can inquire the block cipher module by invoking the "keysize" method. If $algorithm is a hash function ("Digest::"), then $key can be of any size. The optional IV can be used to further seed the crypto algorithm. If no IV is given, a string of zeroes is used. "$ciphertext = $cipher->encrypt $plaintext" Encrypts $plaintext. The input is XORed with the keystream generated from the internal state of the CFB object and that state is updated with the output. $plaintext can be of any length. "$cipher->reset" Resets the internal state. Remember to do that before decrypting, if you use the same object. "$plaintext = $cipher->decrypt $ciphertext" Decrypts $ciphertext. BUGS This is awfully slow. Some classes in "Digest::" do not provide the "add" method, so they will fail. The implementation is a little baroque. AUTHOR Matthias Bauer <matthiasb@acm.org> CHANGES Added the use of an IV. AUTHOR Kees Jan Hermans <kees@phoezo.com> perl v5.32.0 2011-02-04 CFB(3)
NAME | SYNOPSIS | DESCRIPTION | METHODS | BUGS | AUTHOR | CHANGES | AUTHOR
Want to link to this manual page? Use this URL:
<https://www.freebsd.org/cgi/man.cgi?query=Crypt::CFB&sektion=3&manpath=FreeBSD+12.2-RELEASE+and+Ports>