← Index
NYTProf Performance Profile   « line view »
For svc/members/upsert
  Run on Tue Jan 13 11:50:22 2015
Reported on Tue Jan 13 12:09:50 2015

Filename/usr/lib/x86_64-linux-gnu/perl5/5.20/Crypt/Eksblowfish.pm
StatementsExecuted 12 statements in 198µs
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
11130µs30µsCrypt::Eksblowfish::::bootstrapCrypt::Eksblowfish::bootstrap (xsub)
11119µs19µsCrypt::Eksblowfish::::BEGIN@46Crypt::Eksblowfish::BEGIN@46
11110µs18µsCrypt::Eksblowfish::::BEGIN@47Crypt::Eksblowfish::BEGIN@47
1117µs1.50msCrypt::Eksblowfish::::BEGIN@52Crypt::Eksblowfish::BEGIN@52
1116µs17µsCrypt::Eksblowfish::::BEGIN@48Crypt::Eksblowfish::BEGIN@48
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1=head1 NAME
2
3Crypt::Eksblowfish - the Eksblowfish block cipher
4
5=head1 SYNOPSIS
6
7 use Crypt::Eksblowfish;
8
9 $block_size = Crypt::Eksblowfish->blocksize;
10
11 $cipher = Crypt::Eksblowfish->new(8, $salt, $key);
12
13 $block_size = $cipher->blocksize;
14 $ciphertext = $cipher->encrypt($plaintext);
15 $plaintext = $cipher->decrypt($ciphertext);
16
17 $p_array = $cipher->p_array;
18 $s_boxes = $cipher->s_boxes;
19 if($cipher->is_weak) { ...
20
21=head1 DESCRIPTION
22
23An object of this type encapsulates a keyed instance of the Eksblowfish
24block cipher, ready to encrypt and decrypt.
25
26Eksblowfish is a variant of the Blowfish cipher, modified to make
27the key setup very expensive. ("Eks" stands for "expensive key
28schedule".) This doesn't make it significantly cryptographically
29stronger, but is intended to hinder brute-force attacks. It also
30makes it unsuitable for any application requiring key agility. It was
31designed by Niels Provos and David Mazieres for password hashing in
32OpenBSD. See L<Crypt::Eksblowfish::Bcrypt> for the hash algorithm.
33See L<Crypt::Eksblowfish::Blowfish> for the unmodified Blowfish cipher.
34
35Eksblowfish is a parameterised (family-keyed) cipher. It takes a cost
36parameter that controls how expensive the key scheduling is. It also
37takes a family key, known as the "salt". Cost and salt parameters
38together define a cipher family. Within each family, a key determines an
39encryption function in the usual way. See L<Crypt::Eksblowfish::Family>
40for a way to encapsulate an Eksblowfish cipher family.
41
42=cut
43
44package Crypt::Eksblowfish;
45
46348µs119µs
# spent 19µs within Crypt::Eksblowfish::BEGIN@46 which was called: # once (19µs+0s) by Crypt::Eksblowfish::Bcrypt::BEGIN@42 at line 46
{ use 5.006; }
# spent 19µs making 1 call to Crypt::Eksblowfish::BEGIN@46
47223µs227µs
# spent 18µs (10+9) within Crypt::Eksblowfish::BEGIN@47 which was called: # once (10µs+9µs) by Crypt::Eksblowfish::Bcrypt::BEGIN@42 at line 47
use warnings;
# spent 18µs making 1 call to Crypt::Eksblowfish::BEGIN@47 # spent 8µs making 1 call to warnings::import
48232µs228µs
# spent 17µs (6+11) within Crypt::Eksblowfish::BEGIN@48 which was called: # once (6µs+11µs) by Crypt::Eksblowfish::Bcrypt::BEGIN@42 at line 48
use strict;
# spent 17µs making 1 call to Crypt::Eksblowfish::BEGIN@48 # spent 11µs making 1 call to strict::import
49
501400nsour $VERSION = "0.009";
51
52291µs22.99ms
# spent 1.50ms (7µs+1.49) within Crypt::Eksblowfish::BEGIN@52 which was called: # once (7µs+1.49ms) by Crypt::Eksblowfish::Bcrypt::BEGIN@42 at line 52
use parent "Crypt::Eksblowfish::Subkeyed";
# spent 1.50ms making 1 call to Crypt::Eksblowfish::BEGIN@52 # spent 1.49ms making 1 call to parent::import
53
541400nsdie "mismatched versions of Crypt::Eksblowfish modules"
55 unless $Crypt::Eksblowfish::Subkeyed::VERSION eq $VERSION;
56
57=head1 CLASS METHODS
58
59=over
60
61=item Crypt::Eksblowfish->blocksize
62
63Returns 8, indicating the Eksblowfish block size of 8 octets. This method
64may be called on either the class or an instance.
65
66=back
67
68=head1 CONSTRUCTOR
69
70=over
71
72=item Crypt::Eksblowfish->new(COST, SALT, KEY)
73
74Performs key setup on a new instance of the Eksblowfish algorithm,
75returning the keyed state. The KEY may be any length from 1 octet to
7672 octets inclusive. The SALT is a family key, and must be exactly
7716 octets. COST is an integer parameter controlling the expense of
78keying: the number of operations in key setup is proportional to 2^COST.
79All three parameters influence all the subkeys; changing any of them
80produces a different encryption function.
81
82Due to the mandatory family-keying parameters (COST and SALT), this
83constructor does not match the interface expected by C<Crypt::CBC>
84and similar crypto plumbing modules. To
85use Eksblowfish with them it is necessary to have an object that
86encapsulates a cipher family and provides a constructor that takes only a
87key argument. That facility is supplied by C<Crypt::Eksblowfish::Family>.
88
89=back
90
91=head1 METHODS
92
93=over
94
95=item $cipher->blocksize
96
97Returns 8, indicating the Eksblowfish block size of 8 octets. This method
98may be called on either the class or an instance.
99
100=item $cipher->encrypt(PLAINTEXT)
101
102PLAINTEXT must be exactly eight octets. The block is encrypted, and
103the ciphertext is returned.
104
105=item $cipher->decrypt(CIPHERTEXT)
106
107CIPHERTEXT must be exactly eight octets. The block is decrypted, and
108the plaintext is returned.
109
110=item $cipher->p_array
111
112=item $cipher->s_boxes
113
114These methods extract the subkeys from the keyed cipher.
115This is not required in ordinary operation. See the superclass
116L<Crypt::Eksblowfish::Subkeyed> for details.
117
118=item $cipher->is_weak
119
120This method checks whether the cipher has been keyed with a weak key.
121It may be desired to avoid using weak keys. See the superclass
122L<Crypt::Eksblowfish::Subkeyed> for details.
123
124=back
125
126=head1 SEE ALSO
127
128L<Crypt::Eksblowfish::Bcrypt>,
129L<Crypt::Eksblowfish::Blowfish>,
130L<Crypt::Eksblowfish::Family>,
131L<Crypt::Eksblowfish::Subkeyed>,
132L<http://www.usenix.org/events/usenix99/provos/provos_html/node4.html>
133
134=head1 AUTHOR
135
136Eksblowfish guts originally by Solar Designer (solar at openwall.com).
137
138Modifications and Perl interface by Andrew Main (Zefram)
139<zefram@fysh.org>.
140
141=head1 COPYRIGHT
142
143Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011
144Andrew Main (Zefram) <zefram@fysh.org>
145
146The original Eksblowfish code (in the form of crypt()) from which
147this module is derived is in the public domain. It may be found at
148L<http://www.openwall.com/crypt/>.
149
150=head1 LICENSE
151
152This module is free software; you can redistribute it and/or modify it
153under the same terms as Perl itself.
154
155=cut
156
15712µs1;
 
# spent 30µs within Crypt::Eksblowfish::bootstrap which was called: # once (30µs+0s) by DynaLoader::bootstrap at line 210 of DynaLoader.pm
sub Crypt::Eksblowfish::bootstrap; # xsub