1Crypt::Mode::OFB(3) User Contributed Perl Documentation Crypt::Mode::OFB(3)
2
3
4
6 Crypt::Mode::OFB - Block cipher mode OFB [Output feedback]
7
9 use Crypt::Mode::OFB;
10 my $m = Crypt::Mode::OFB->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
27 This module implements OFB cipher mode. NOTE: it works only with
28 ciphers from CryptX (Crypt::Cipher::NNNN).
29
31 new
32 my $m = Crypt::Mode::OFB->new('AES');
33 #or
34 my $m = Crypt::Mode::OFB->new('AES', $cipher_rounds);
35
36 # $cipher_rounds ... optional num of rounds for given cipher
37
38 encrypt
39 my $ciphertext = $m->encrypt($plaintext, $key, $iv);
40
41 decrypt
42 my $plaintext = $m->decrypt($ciphertext, $key, $iv);
43
44 start_encrypt
45 $m->start_encrypt($key, $iv);
46
47 start_decrypt
48 $m->start_decrypt($key, $iv);
49
50 add
51 # in encrypt mode
52 my $plaintext = $m->add($ciphertext);
53
54 # in decrypt mode
55 my $ciphertext = $m->add($plaintext);
56
58 · CryptX, Crypt::Cipher
59
60 · Crypt::Cipher::AES, Crypt::Cipher::Blowfish, ...
61
62 · <https://en.wikipedia.org/wiki/Block_cipher_mode_of_operation#Output_feedback_.28OFB.29>
63
64
65
66perl v5.28.0 2017-09-15 Crypt::Mode::OFB(3)