{
    "mode": "man",
    "parameter": "ecb_crypt",
    "section": "3",
    "url": "https://www.chedong.com/phpMan.php/man/ecb_crypt/3/json",
    "generated": "2026-06-09T11:38:32Z",
    "synopsis": "#include <rpc/descrypt.h>\nint\necbcrypt(char *key, char *data, unsigned datalen, unsigned mode);\nint\ncbccrypt(char *key, char *data, unsigned datalen, unsigned mode, char *ivec);\nvoid\ndessetparity(char *key);",
    "sections": {
        "NAME": {
            "content": "descrypt, ecbcrypt, cbccrypt, dessetparity — fast DES encryption\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "#include <rpc/descrypt.h>\n\nint\necbcrypt(char *key, char *data, unsigned datalen, unsigned mode);\n\nint\ncbccrypt(char *key, char *data, unsigned datalen, unsigned mode, char *ivec);\n\nvoid\ndessetparity(char *key);\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "The ecbcrypt() and cbccrypt() functions implement the NBS DES (Data Encryption Standard).\nThese routines are faster and more general purpose than crypt(3).  They also are able to uti‐\nlize DES hardware if it is available.  The ecbcrypt() function encrypts in ECB (Electronic\nCode Book) mode, which encrypts blocks of data independently.  The cbccrypt() function en‐\ncrypts in CBC (Cipher Block Chaining) mode, which chains together successive blocks.  CBC mode\nprotects against insertions, deletions and substitutions of blocks.  Also, regularities in the\nclear text will not appear in the cipher text.\n\nHere is how to use these routines.  The first argument, key, is the 8-byte encryption key with\nparity.  To set the key's parity, which for DES is in the low bit of each byte, use\ndessetparity().  The second argument, data, contains the data to be encrypted or decrypted.\nThe third argument, datalen, is the length in bytes of data, which must be a multiple of 8.\nThe fourth argument, mode, is formed by OR'ing together some things.  For the encryption direc‐\ntion OR in either DESENCRYPT or DESDECRYPT.  For software versus hardware encryption, OR in\neither DESHW or DESSW.  If DESHW is specified, and there is no hardware, then the encryption\nis performed in software and the routine returns DESERRNOHWDEVICE.  For cbccrypt(), the ivec\nargument is the 8-byte initialization vector for the chaining.  It is updated to the next ini‐\ntialization vector upon return.\n",
            "subsections": []
        },
        "ERRORS": {
            "content": "[DESERRNONE]        No error.\n[DESERRNOHWDEVICE]  Encryption succeeded, but done in software instead of the requested hard‐\nware.\n[DESERRHWERR]       An error occurred in the hardware or driver.\n[DESERRBADPARAM]    Bad argument to routine.\n\nGiven a result status stat, the macro DESFAILED(stat) is false only for the first two sta‐\ntuses.\n",
            "subsections": []
        },
        "AVAILABILITY": {
            "content": "The ecbcrypt(), cbccrypt(), and dessetparity() functions are part of libtirpc.\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "crypt(3)\n",
            "subsections": []
        },
        "RESTRICTIONS": {
            "content": "These routines are not available in RPCSRC 4.0.  This information is provided to describe the\nDES interface expected by Secure RPC.\n\nBSD                             October 6, 1987                            BSD",
            "subsections": []
        }
    },
    "summary": "descrypt, ecbcrypt, cbccrypt, dessetparity — fast DES encryption",
    "flags": [],
    "examples": [],
    "see_also": [
        {
            "name": "crypt",
            "section": "3",
            "url": "https://www.chedong.com/phpMan.php/man/crypt/3/json"
        }
    ]
}