1Crypt::Eksblowfish(3) User Contributed Perl DocumentationCrypt::Eksblowfish(3)
2
3
4
6 Crypt::Eksblowfish - the Eksblowfish block cipher
7
9 use Crypt::Eksblowfish;
10
11 $block_size = Crypt::Eksblowfish->blocksize;
12
13 $cipher = Crypt::Eksblowfish->new(8, $salt, $key);
14
15 $block_size = $cipher->blocksize;
16 $ciphertext = $cipher->encrypt($plaintext);
17 $plaintext = $cipher->decrypt($ciphertext);
18
19 $p_array = $cipher->p_array;
20 $s_boxes = $cipher->s_boxes;
21 if($cipher->is_weak) { ...
22
24 An object of this type encapsulates a keyed instance of the Eksblowfish
25 block cipher, ready to encrypt and decrypt.
26
27 Eksblowfish is a variant of the Blowfish cipher, modified to make the
28 key setup very expensive. ("Eks" stands for "expensive key schedule".)
29 This doesn't make it significantly cryptographically stronger, but is
30 intended to hinder brute-force attacks. It also makes it unsuitable
31 for any application requiring key agility. It was designed by Niels
32 Provos and David Mazieres for password hashing in OpenBSD. See
33 Crypt::Eksblowfish::Bcrypt for the hash algorithm. See
34 Crypt::Eksblowfish::Blowfish for the unmodified Blowfish cipher.
35
36 Eksblowfish is a parameterised (family-keyed) cipher. It takes a cost
37 parameter that controls how expensive the key scheduling is. It also
38 takes a family key, known as the "salt". Cost and salt parameters
39 together define a cipher family. Within each family, a key determines
40 an encryption function in the usual way. See
41 Crypt::Eksblowfish::Family for a way to encapsulate an Eksblowfish
42 cipher family.
43
45 Crypt::Eksblowfish->blocksize
46 Returns 8, indicating the Eksblowfish block size of 8 octets. This
47 method may be called on either the class or an instance.
48
50 Crypt::Eksblowfish->new(COST, SALT, KEY)
51 Performs key setup on a new instance of the Eksblowfish algorithm,
52 returning the keyed state. The KEY may be any length from 1 octet
53 to 72 octets inclusive. The SALT is a family key, and must be
54 exactly 16 octets. COST is an integer parameter controlling the
55 expense of keying: the number of operations in key setup is
56 proportional to 2^COST. All three parameters influence all the
57 subkeys; changing any of them produces a different encryption
58 function.
59
60 Due to the mandatory family-keying parameters (COST and SALT), this
61 constructor does not match the interface expected by "Crypt::CBC"
62 and similar crypto plumbing modules. To use Eksblowfish with them
63 it is necessary to have an object that encapsulates a cipher family
64 and provides a constructor that takes only a key argument. That
65 facility is supplied by "Crypt::Eksblowfish::Family".
66
68 $cipher->blocksize
69 Returns 8, indicating the Eksblowfish block size of 8 octets. This
70 method may be called on either the class or an instance.
71
72 $cipher->encrypt(PLAINTEXT)
73 PLAINTEXT must be exactly eight octets. The block is encrypted,
74 and the ciphertext is returned.
75
76 $cipher->decrypt(CIPHERTEXT)
77 CIPHERTEXT must be exactly eight octets. The block is decrypted,
78 and the plaintext is returned.
79
80 $cipher->p_array
81 $cipher->s_boxes
82 These methods extract the subkeys from the keyed cipher. This is
83 not required in ordinary operation. See the superclass
84 Crypt::Eksblowfish::Subkeyed for details.
85
86 $cipher->is_weak
87 This method checks whether the cipher has been keyed with a weak
88 key. It may be desired to avoid using weak keys. See the
89 superclass Crypt::Eksblowfish::Subkeyed for details.
90
92 Crypt::Eksblowfish::Bcrypt, Crypt::Eksblowfish::Blowfish,
93 Crypt::Eksblowfish::Family, Crypt::Eksblowfish::Subkeyed,
94 <http://www.usenix.org/events/usenix99/provos/provos_html/node4.html>
95
97 Eksblowfish guts originally by Solar Designer (solar at openwall.com).
98
99 Modifications and Perl interface by Andrew Main (Zefram)
100 <zefram@fysh.org>.
101
103 Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Andrew Main (Zefram)
104 <zefram@fysh.org>
105
106 The original Eksblowfish code (in the form of crypt()) from which this
107 module is derived is in the public domain. It may be found at
108 <http://www.openwall.com/crypt/>.
109
111 This module is free software; you can redistribute it and/or modify it
112 under the same terms as Perl itself.
113
114
115
116perl v5.32.0 2020-07-28 Crypt::Eksblowfish(3)