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
75 perfectly valid to use for this. Additionally, the current maintainer
76 for Crypt::Blowfish may or may not release Crypt::CBC_R which replaces
77 the default 'RandomIV' initialization vector in Crypt::CBC with a
78 random initialization vector. (to the limits of /dev/urandom and
79 associates) In either case, please email amused@pobox.com for
80 Crypt::CBC_R.
81
83 Crypt::CBC, Crypt::DES, Crypt::IDEA
84
85 Bruce Schneier, Applied Cryptography, 1995, Second Edition, published
86 by John Wiley & Sons, Inc.
87
89 The implementation of the Blowfish algorithm was developed by, and is
90 copyright of, A.M. Kuchling.
91
92 Other parts of the perl extension and module are copyright of Systemics
93 Ltd ( http://www.systemics.com/ ).
94
95 Code revisions, updates, and standalone release are copyright 1999-2001
96 W3Works, LLC.
97
99 Original algorithm, Bruce Shneier. Original implementation, A.M.
100 Kuchling. Original Perl implementation, Systemics Ltd. Current
101 maintenance by W3Works, LLC.
102
103 Current revision and maintainer: Dave Paris <amused@pobox.com>
104
105
106
107perl v5.12.0 2005-12-02 Blowfish(3)