{
    "mode": "perldoc",
    "parameter": "Crypt::DES",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/perldoc/Crypt%3A%3ADES/json",
    "generated": "2026-06-10T17:05:38Z",
    "synopsis": "use Crypt::DES;",
    "sections": {
        "NAME": {
            "content": "Crypt::DES - Perl DES encryption module\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "use Crypt::DES;\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "The module implements the Crypt::CBC interface, which has the following methods\n\nblocksize =item keysize =item encrypt =item decrypt\n",
            "subsections": []
        },
        "FUNCTIONS": {
            "content": "blocksize\nReturns the size (in bytes) of the block cipher.\n\nkeysize\nReturns the size (in bytes) of the key. Optimal size is 8 bytes.\n\nnew\nmy $cipher = new Crypt::DES $key;\n\nThis creates a new Crypt::DES BlockCipher object, using $key, where $key is a key of\n\"keysize()\" bytes.\n\nencrypt\nmy $cipher = new Crypt::DES $key;\nmy $ciphertext = $cipher->encrypt($plaintext);\n\nThis function encrypts $plaintext and returns the $ciphertext where $plaintext and\n$ciphertext should be of \"blocksize()\" bytes.\n\ndecrypt\nmy $cipher = new Crypt::DES $key;\nmy $plaintext = $cipher->decrypt($ciphertext);\n\nThis function decrypts $ciphertext and returns the $plaintext where $plaintext and\n$ciphertext should be of \"blocksize()\" bytes.\n",
            "subsections": []
        },
        "EXAMPLE": {
            "content": "my $key = pack(\"H16\", \"0123456789ABCDEF\");\nmy $cipher = new Crypt::DES $key;\nmy $ciphertext = $cipher->encrypt(\"plaintex\");  # NB - 8 bytes\nprint unpack(\"H16\", $ciphertext), \"\\n\";\n",
            "subsections": []
        },
        "NOTES": {
            "content": "Do note that DES only uses 8 byte keys and only works on 8 byte data blocks. If you're intending\nto encrypt larger blocks or entire files, please use Crypt::CBC in conjunction with this module.\nSee the Crypt::CBC documentation for proper syntax and use.\n\nAlso note that the DES algorithm is, by today's standard, weak encryption. Crypt::Blowfish is\nhighly recommended if you're interested in using strong encryption and a faster algorithm.\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "Crypt::Blowfish Crypt::IDEA\n\nBruce Schneier, *Applied Cryptography*, 1995, Second Edition, published by John Wiley & Sons,\nInc.\n",
            "subsections": []
        },
        "COPYRIGHT": {
            "content": "The implementation of the DES algorithm was developed by, and is copyright of, Eric Young\n(eay@mincom.oz.au). Other parts of the perl extension and module are copyright of Systemics Ltd\n( http://www.systemics.com/ ). Cross-platform work and packaging for single algorithm\ndistribution is copyright of W3Works, LLC.\n",
            "subsections": []
        },
        "MAINTAINER": {
            "content": "This single-algorithm package and cross-platform code is maintained by Dave Paris\n<amused@pobox.com>.\n",
            "subsections": []
        }
    },
    "summary": "Crypt::DES - Perl DES encryption module",
    "flags": [],
    "examples": [
        "my $key = pack(\"H16\", \"0123456789ABCDEF\");",
        "my $cipher = new Crypt::DES $key;",
        "my $ciphertext = $cipher->encrypt(\"plaintex\");  # NB - 8 bytes",
        "print unpack(\"H16\", $ciphertext), \"\\n\";"
    ],
    "see_also": []
}