1Blowfish(3) User Contributed Perl Documentation Blowfish(3)
2
3
4
6 Crypt::Blowfish - Perl Blowfish encryption module
7
9 use Crypt::Blowfish;
10 my $cipher = new Crypt::Blowfish $key;
11 my $ciphertext = $cipher->encrypt($plaintext);
12 my $plaintext = $cipher->decrypt($ciphertext);
13
15 Blowfish is capable of strong encryption and can use key sizes up to 56
16 bytes (a 448 bit key). You're encouraged to take advantage of the full
17 key size to ensure the strongest encryption possible from this module.
18
19 Crypt::Blowfish has the following methods:
20
21 blocksize()
22 keysize()
23 encrypt()
24 decrypt()
25
27 blocksize
28 Returns the size (in bytes) of the block cipher.
29
30 Crypt::Blowfish doesn't return a key size due to its ability to use
31 variable-length keys. (well, more accurately, it won't as of 2.09
32 .. for now, it does. expect that to change)
33
34 new
35 my $cipher = new Crypt::Blowfish $key;
36
37 This creates a new Crypt::Blowfish BlockCipher object, using $key,
38 where $key is a key of "keysize()" bytes (minimum of eight bytes).
39
40 encrypt
41 my $cipher = new Crypt::Blowfish $key;
42 my $ciphertext = $cipher->encrypt($plaintext);
43
44 This function encrypts $plaintext and returns the $ciphertext where
45 $plaintext and $ciphertext must be of "blocksize()" bytes. (hint:
46 Blowfish is an 8 byte block cipher)
47
48 decrypt
49 my $cipher = new Crypt::Blowfish $key;
50 my $plaintext = $cipher->decrypt($ciphertext);
51
52 This function decrypts $ciphertext and returns the $plaintext where
53 $plaintext and $ciphertext must be of "blocksize()" bytes. (hint:
54 see previous hint)
55
57 my $key = pack("H16", "0123456789ABCDEF"); # min. 8 bytes
58 my $cipher = new Crypt::Blowfish $key;
59 my $ciphertext = $cipher->encrypt("plaintex"); # SEE NOTES
60 print unpack("H16", $ciphertext), "\n";
61
63 Please see the README document for platforms and performance
64 tests.
65
67 The module is capable of being used with Crypt::CBC. You're encouraged
68 to read the perldoc for Crypt::CBC if you intend to use this module for
69 Cipher Block Chaining modes. In fact, if you have any intentions of
70 encrypting more than eight bytes of data with this, or any other block
71 cipher, you're going to need some type of block chaining help.
72 Crypt::CBC tends to be very good at this. If you're not going to
73 encrypt more than eight bytes, your data must be exactly eight bytes
74 long. If need be, do your own padding. "\0" as a null byte is per‐
75 fectly valid to use for this. Additionally, the current maintainer for
76 Crypt::Blowfish may or may not release Crypt::CBC_R which replaces the
77 default 'RandomIV' initialization vector in Crypt::CBC with a random
78 initialization vector. (to the limits of /dev/urandom and associates)
79 In either case, please email amused@pobox.com for Crypt::CBC_R.
80
82 Crypt::CBC, Crypt::DES, Crypt::IDEA
83
84 Bruce Schneier, Applied Cryptography, 1995, Second Edition, published
85 by John Wiley & Sons, Inc.
86
88 The implementation of the Blowfish algorithm was developed by, and is
89 copyright of, A.M. Kuchling.
90
91 Other parts of the perl extension and module are copyright of Systemics
92 Ltd ( http://www.systemics.com/ ).
93
94 Code revisions, updates, and standalone release are copyright 1999-2001
95 W3Works, LLC.
96
98 Original algorithm, Bruce Shneier. Original implementation, A.M.
99 Kuchling. Original Perl implementation, Systemics Ltd. Current main‐
100 tenance by W3Works, LLC.
101
102 Current revision and maintainer: Dave Paris <amused@pobox.com>
103
104
105
106perl v5.8.8 2005-12-02 Blowfish(3)