1Crypt::Mode::CFB(3)   User Contributed Perl Documentation  Crypt::Mode::CFB(3)
2
3
4

NAME

6       Crypt::Mode::CFB - Block cipher mode CFB [Cipher feedback]
7

SYNOPSIS

9          use Crypt::Mode::CFB;
10          my $m = Crypt::Mode::CFB->new('AES');
11
12          #(en|de)crypt at once
13          my $ciphertext = $m->encrypt($plaintext, $key, $iv);
14          my $plaintext = $m->decrypt($ciphertext, $key, $iv);
15
16          #encrypt more chunks
17          $m->start_encrypt($key, $iv);
18          my $ciphertext = $m->add('some data');
19          $ciphertext .= $m->add('more data');
20
21          #decrypt more chunks
22          $m->start_decrypt($key, $iv);
23          my $plaintext = $m->add($some_ciphertext);
24          $plaintext .= $m->add($more_ciphertext);
25

DESCRIPTION

27       This module implements CFB cipher mode. NOTE: it works only with
28       ciphers from CryptX (Crypt::Cipher::NNNN).
29

METHODS

31   new
32        my $m = Crypt::Mode::CFB->new($name);
33        #or
34        my $m = Crypt::Mode::CFB->new($name, $cipher_rounds);
35
36        # $name ............ one of 'AES', 'Anubis', 'Blowfish', 'CAST5', 'Camellia', 'DES', 'DES_EDE',
37        #                    'KASUMI', 'Khazad', 'MULTI2', 'Noekeon', 'RC2', 'RC5', 'RC6',
38        #                    'SAFERP', 'SAFER_K128', 'SAFER_K64', 'SAFER_SK128', 'SAFER_SK64',
39        #                    'SEED', 'Skipjack', 'Twofish', 'XTEA', 'IDEA', 'Serpent'
40        #                    simply any <NAME> for which there exists Crypt::Cipher::<NAME>
41        # $cipher_rounds ... optional num of rounds for given cipher
42
43   encrypt
44          my $ciphertext = $m->encrypt($plaintext, $key, $iv);
45
46   decrypt
47          my $plaintext = $m->decrypt($ciphertext, $key, $iv);
48
49   start_encrypt
50          $m->start_encrypt($key, $iv);
51
52   start_decrypt
53          $m->start_decrypt($key, $iv);
54
55   add
56          # in encrypt mode
57          my $plaintext = $m->add($ciphertext);
58
59          # in decrypt mode
60          my $ciphertext = $m->add($plaintext);
61

SEE ALSO

63       •   CryptX, Crypt::Cipher
64
65       •   Crypt::Cipher::AES, Crypt::Cipher::Blowfish, ...
66
67       •   <https://en.wikipedia.org/wiki/Block_cipher_mode_of_operation#Cipher_feedback_.28CFB.29>
68
69
70
71perl v5.36.1                      2023-10-04               Crypt::Mode::CFB(3)
Impressum