1Crypt::Eksblowfish::BloUwsfeirshC(o3n)tributed Perl DocuCmreynptta:t:iEoknsblowfish::Blowfish(3)
2
3
4
6 Crypt::Eksblowfish::Blowfish - Blowfish block cipher via Eksblowfish
7 engine
8
10 use Crypt::Eksblowfish::Blowfish;
11
12 $block_size = Crypt::Eksblowfish::Blowfish->blocksize;
13 $key_size = Crypt::Eksblowfish::Blowfish->keysize;
14
15 $cipher = Crypt::Eksblowfish::Blowfish->new($key);
16
17 $block_size = $cipher->blocksize;
18 $ciphertext = $cipher->encrypt($plaintext);
19 $plaintext = $cipher->decrypt($ciphertext);
20
21 $p_array = $cipher->p_array;
22 $s_boxes = $cipher->s_boxes;
23 if($cipher->is_weak) { ...
24
26 An object of this type encapsulates a keyed instance of the Blowfish
27 block cipher, ready to encrypt and decrypt.
28
29 Blowfish is a symmetric cipher algorithm designed by Bruce Schneier in
30 1993. It operates on 64-bit blocks, and takes a variable-length key
31 from 32 bits (4 octets) to 448 bits (56 octets) in increments of 8 bits
32 (1 octet).
33
34 This implementation of Blowfish uses an encryption engine that was
35 originally implemented in order to support Eksblowfish, which is a
36 variant of Blowfish modified to make keying particularly expensive.
37 See Crypt::Eksblowfish for that variant; this class implements the
38 original Blowfish.
39
41 Crypt::Eksblowfish::Blowfish->blocksize
42 Returns 8, indicating the Blowfish block size of 8 octets. This
43 method may be called on either the class or an instance.
44
45 Crypt::Eksblowfish::Blowfish->keysize
46 Returns 0, indicating that the key size is variable. This
47 situation is handled specially by "Crypt::CBC".
48
50 Crypt::Eksblowfish::Blowfish->new(KEY)
51 Performs key setup on a new instance of the Blowfish algorithm,
52 returning the keyed state. The KEY may be any length from 4 octets
53 to 56 octets inclusive.
54
55 You may occasionally come across an alleged Blowfish key that is
56 outside this length range, and so is rejected by this constructor.
57 Blowfish can internally process a key of any octet length up to 72
58 octets, and some implementations don't enforce the official length
59 restrictions. If it is necessary for compatibility, a key of out-
60 of-range length can be processed by
61 Crypt::Eksblowfish::Uklblowfish.
62
64 $cipher->blocksize
65 Returns 8, indicating the Blowfish block size of 8 octets. This
66 method may be called on either the class or an instance.
67
68 $cipher->encrypt(PLAINTEXT)
69 PLAINTEXT must be exactly eight octets. The block is encrypted,
70 and the ciphertext is returned.
71
72 $cipher->decrypt(CIPHERTEXT)
73 CIPHERTEXT must be exactly eight octets. The block is decrypted,
74 and the plaintext is returned.
75
76 $cipher->p_array
77 $cipher->s_boxes
78 These methods extract the subkeys from the keyed cipher. This is
79 not required in ordinary operation. See the superclass
80 Crypt::Eksblowfish::Subkeyed for details.
81
82 $cipher->is_weak
83 This method checks whether the cipher has been keyed with a weak
84 key. It may be desired to avoid using weak keys. See the
85 superclass Crypt::Eksblowfish::Subkeyed for details.
86
88 Crypt::Eksblowfish, Crypt::Eksblowfish::Subkeyed,
89 Crypt::Eksblowfish::Uklblowfish,
90 <http://www.schneier.com/blowfish.html>
91
93 Eksblowfish guts originally by Solar Designer (solar at openwall.com).
94
95 Modifications and Perl interface by Andrew Main (Zefram)
96 <zefram@fysh.org>.
97
99 Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Andrew Main (Zefram)
100 <zefram@fysh.org>
101
102 The original Eksblowfish code (in the form of crypt()) from which this
103 module is derived is in the public domain. It may be found at
104 <http://www.openwall.com/crypt/>.
105
107 This module is free software; you can redistribute it and/or modify it
108 under the same terms as Perl itself.
109
110
111
112perl v5.36.0 2023-01-20 Crypt::Eksblowfish::Blowfish(3)