{
    "mode": "perldoc",
    "parameter": "Crypt::Blowfish",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/perldoc/Crypt%3A%3ABlowfish/json",
    "generated": "2026-10-05T17:47:10Z",
    "synopsis": "use Crypt::Blowfish;\nmy $cipher = new Crypt::Blowfish $key;\nmy $ciphertext = $cipher->encrypt($plaintext);\nmy $plaintext  = $cipher->decrypt($ciphertext);\nYou probably want to use this in conjunction with\na block chaining module like Crypt::CBC.",
    "sections": {
        "NAME": {
            "content": "Crypt::Blowfish - Perl Blowfish encryption module\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "use Crypt::Blowfish;\nmy $cipher = new Crypt::Blowfish $key;\nmy $ciphertext = $cipher->encrypt($plaintext);\nmy $plaintext  = $cipher->decrypt($ciphertext);\n\nYou probably want to use this in conjunction with\na block chaining module like Crypt::CBC.\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "Blowfish is capable of strong encryption and can use key sizes up to 56 bytes (a 448 bit key).\nYou're encouraged to take advantage of the full key size to ensure the strongest encryption\npossible from this module.\n\nCrypt::Blowfish has the following methods:\n\nblocksize()\nkeysize()\nencrypt()\ndecrypt()\n",
            "subsections": []
        },
        "FUNCTIONS": {
            "content": "blocksize\nReturns the size (in bytes) of the block cipher.\n\nCrypt::Blowfish doesn't return a key size due to its ability to use variable-length keys.\nMore accurately, it shouldn't, but it does anyway to play nicely with others.\n\nnew\nmy $cipher = new Crypt::Blowfish $key;\n\nThis creates a new Crypt::Blowfish BlockCipher object, using $key, where $key is a key of\nkeysize() bytes (minimum of eight bytes).\n\nencrypt\nmy $cipher = new Crypt::Blowfish $key;\nmy $ciphertext = $cipher->encrypt($plaintext);\n\nThis function encrypts $plaintext and returns the $ciphertext where $plaintext and\n$ciphertext must be of blocksize() bytes. (hint: Blowfish is an 8 byte block cipher)\n\ndecrypt\nmy $cipher = new Crypt::Blowfish $key;\nmy $plaintext = $cipher->decrypt($ciphertext);\n\nThis function decrypts $ciphertext and returns the $plaintext where $plaintext and\n$ciphertext must be of blocksize() bytes. (hint: see previous hint)\n",
            "subsections": []
        },
        "EXAMPLE": {
            "content": "my $key = pack(\"H16\", \"0123456789ABCDEF\");  # min. 8 bytes\nmy $cipher = new Crypt::Blowfish $key;\nmy $ciphertext = $cipher->encrypt(\"plaintex\");  # SEE NOTES\nprint unpack(\"H16\", $ciphertext), \"\\n\";\n",
            "subsections": []
        },
        "PLATFORMS": {
            "content": "Please see the README document for platforms and performance\ntests.\n",
            "subsections": []
        },
        "NOTES": {
            "content": "The module is capable of being used with Crypt::CBC. You're encouraged to read the perldoc for\nCrypt::CBC if you intend to use this module for Cipher Block Chaining modes. In fact, if you\nhave any intentions of encrypting more than eight bytes of data with this, or any other block\ncipher, you're going to need some type of block chaining help. Crypt::CBC tends to be very good\nat this. If you're not going to encrypt more than eight bytes, your data must be exactly eight\nbytes long. If need be, do your own padding. \"\\0\" as a null byte is perfectly valid to use for\nthis.\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "Crypt::CBC, Crypt::DES, Crypt::IDEA\n\nBruce Schneier, *Applied Cryptography*, 1995, Second Edition, published by John Wiley & Sons,\nInc.\n",
            "subsections": []
        },
        "COPYRIGHT": {
            "content": "The implementation of the Blowfish algorithm was developed by, and is copyright of, A.M.\nKuchling.\n\nOther parts of the perl extension and module are copyright of Systemics Ltd (\nhttp://www.systemics.com/ ).\n\nCode revisions, updates, and standalone release are copyright 1999-2010 W3Works, LLC.\n",
            "subsections": []
        },
        "AUTHOR": {
            "content": "Original algorithm, Bruce Shneier. Original implementation, A.M. Kuchling. Original Perl\nimplementation, Systemics Ltd. Current maintenance by W3Works, LLC.\n\nCurrent revision and maintainer: Dave Paris <amused@pobox.com>\n",
            "subsections": []
        }
    },
    "summary": "Crypt::Blowfish - Perl Blowfish encryption module",
    "flags": [],
    "examples": [
        "my $key = pack(\"H16\", \"0123456789ABCDEF\");  # min. 8 bytes",
        "my $cipher = new Crypt::Blowfish $key;",
        "my $ciphertext = $cipher->encrypt(\"plaintex\");  # SEE NOTES",
        "print unpack(\"H16\", $ciphertext), \"\\n\";"
    ],
    "see_also": []
}