← Index
NYTProf Performance Profile   « line view »
For t/bug-md-11.t
  Run on Fri Mar 8 13:27:24 2024
Reported on Fri Mar 8 13:30:23 2024

Filename/home/micha/.plenv/versions/5.38.2/lib/perl5/site_perl/5.38.2/x86_64-linux/Crypt/Mode/CBC.pm
StatementsExecuted 8 statements in 182µs
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
111155µs9.64msCrypt::Mode::CBC::::BEGIN@9Crypt::Mode::CBC::BEGIN@9
1118µs10µsCrypt::Mode::CBC::::BEGIN@5Crypt::Mode::CBC::BEGIN@5
1113µs18µsCrypt::Mode::CBC::::BEGIN@6Crypt::Mode::CBC::BEGIN@6
0000s0sCrypt::Mode::CBC::::CLONE_SKIPCrypt::Mode::CBC::CLONE_SKIP
0000s0sCrypt::Mode::CBC::::decryptCrypt::Mode::CBC::decrypt
0000s0sCrypt::Mode::CBC::::encryptCrypt::Mode::CBC::encrypt
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1package Crypt::Mode::CBC;
2
3### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY!
4
5216µs211µs
# spent 10µs (8+1) within Crypt::Mode::CBC::BEGIN@5 which was called: # once (8µs+1µs) by Spreadsheet::ParseXLSX::Decryptor::BEGIN@10 at line 5
use strict;
# spent 10µs making 1 call to Crypt::Mode::CBC::BEGIN@5 # spent 1µs making 1 call to strict::import
6220µs232µs
# spent 18µs (3+14) within Crypt::Mode::CBC::BEGIN@6 which was called: # once (3µs+14µs) by Spreadsheet::ParseXLSX::Decryptor::BEGIN@10 at line 6
use warnings;
# spent 18µs making 1 call to Crypt::Mode::CBC::BEGIN@6 # spent 14µs making 1 call to warnings::import
71300nsour $VERSION = '0.080';
8
92144µs29.64ms
# spent 9.64ms (155µs+9.48) within Crypt::Mode::CBC::BEGIN@9 which was called: # once (155µs+9.48ms) by Spreadsheet::ParseXLSX::Decryptor::BEGIN@10 at line 9
use Crypt::Cipher;
# spent 9.64ms making 1 call to Crypt::Mode::CBC::BEGIN@9 # spent 1µs making 1 call to UNIVERSAL::import
10
11sub encrypt {
12 my ($self, $pt) = (shift, shift);
13 local $SIG{__DIE__} = \&CryptX::_croak;
14 $self->start_encrypt(@_)->add($pt) . $self->finish;
15}
16
17sub decrypt {
18 my ($self, $ct) = (shift, shift);
19 local $SIG{__DIE__} = \&CryptX::_croak;
20 $self->start_decrypt(@_)->add($ct) . $self->finish;
21}
22
23sub CLONE_SKIP { 1 } # prevent cloning
24
2512µs1;
26
27=pod
28
29=head1 NAME
30
31Crypt::Mode::CBC - Block cipher mode CBC [Cipher-block chaining]
32
33=head1 SYNOPSIS
34
35 use Crypt::Mode::CBC;
36 my $m = Crypt::Mode::CBC->new('AES');
37
38 #(en|de)crypt at once
39 my $ciphertext = $m->encrypt($plaintext, $key, $iv);
40 my $plaintext = $m->decrypt($ciphertext, $key, $iv);
41
42 #encrypt more chunks
43 $m->start_encrypt($key, $iv);
44 my $ciphertext = $m->add('some data');
45 $ciphertext .= $m->add('more data');
46 $ciphertext .= $m->finish;
47
48 #decrypt more chunks
49 $m->start_decrypt($key, $iv);
50 my $plaintext = $m->add($some_ciphertext);
51 $plaintext .= $m->add($more_ciphertext);
52 $plaintext .= $m->finish;
53
54=head1 DESCRIPTION
55
56This module implements CBC cipher mode. B<NOTE:> it works only with ciphers from L<CryptX> (Crypt::Cipher::NNNN).
57
58=head1 METHODS
59
60=head2 new
61
62 my $m = Crypt::Mode::CBC->new($name);
63 #or
64 my $m = Crypt::Mode::CBC->new($name, $padding);
65 #or
66 my $m = Crypt::Mode::CBC->new($name, $padding, $cipher_rounds);
67
68 # $name ....... one of 'AES', 'Anubis', 'Blowfish', 'CAST5', 'Camellia', 'DES', 'DES_EDE',
69 # 'KASUMI', 'Khazad', 'MULTI2', 'Noekeon', 'RC2', 'RC5', 'RC6',
70 # 'SAFERP', 'SAFER_K128', 'SAFER_K64', 'SAFER_SK128', 'SAFER_SK64',
71 # 'SEED', 'Skipjack', 'Twofish', 'XTEA', 'IDEA', 'Serpent'
72 # simply any <NAME> for which there exists Crypt::Cipher::<NAME>
73 # $padding .... 0 no padding (plaintext size has to be multiple of block length)
74 # 1 PKCS5 padding, Crypt::CBC's "standard" - DEFAULT
75 # 2 Crypt::CBC's "oneandzeroes"
76 # 3 ANSI X.923 padding
77 # 4 zero padding
78 # 5 zero padding (+a block of zeros if the output length is divisible by the blocksize)
79 # $cipher_rounds ... optional num of rounds for given cipher
80
81=head2 encrypt
82
83 my $ciphertext = $m->encrypt($plaintext, $key, $iv);
84
85=head2 decrypt
86
87 my $plaintext = $m->decrypt($ciphertext, $key, $iv);
88
89=head2 start_encrypt
90
91 $m->start_encrypt($key, $iv);
92
93=head2 start_decrypt
94
95 $m->start_decrypt($key, $iv);
96
97=head2 add
98
99 # in encrypt mode
100 my $plaintext = $m->add($ciphertext);
101
102 # in decrypt mode
103 my $ciphertext = $m->add($plaintext);
104
105=head2 finish
106
107 #encrypt more chunks
108 $m->start_encrypt($key, $iv);
109 my $ciphertext = '';
110 $ciphertext .= $m->add('some data');
111 $ciphertext .= $m->add('more data');
112 $ciphertext .= $m->finish;
113
114 #decrypt more chunks
115 $m->start_decrypt($key, $iv);
116 my $plaintext = '';
117 $plaintext .= $m->add($some_ciphertext);
118 $plaintext .= $m->add($more_ciphertext);
119 $plaintext .= $m->finish;
120
121=head1 SEE ALSO
122
123=over
124
125=item * L<CryptX|CryptX>, L<Crypt::Cipher>
126
127=item * L<Crypt::Cipher::AES>, L<Crypt::Cipher::Blowfish>, ...
128
129=item * L<https://en.wikipedia.org/wiki/Block_cipher_mode_of_operation#Cipher-block_chaining_.28CBC.29>
130
131=back
132
133=cut