Section: Linux Programmer's Manual (3)
Return to Main Contents
des_crypt, ecb_crypt, cbc_crypt, des_setparity, DES_FAILED - fast
int ecb_crypt(char *key, char *data, unsigned datalen,
int cbc_crypt(char *key, char *data, unsigned datalen,
unsigned mode, char *ivec);
void des_setparity(char *key);
int DES_FAILED(int status);
(Data Encryption Standard).
These routines are faster and more general purpose than
They also are able to utilize
hardware if it is available.
(Electronic Code Book)
mode, which encrypts blocks of data independently.
(Cipher Block Chaining)
mode, which chains together
mode protects against insertions, deletions and
substitutions of blocks.
Also, regularities in the clear text will
not appear in the cipher text.
Here is how to use these routines.
The first argument,
is the 8-byte encryption key with parity.
To set the key's parity, which for
is in the low bit of each byte, use
The second argument,
contains the data to be encrypted or decrypted.
is the length in bytes of
which must be a multiple of 8.
The fourth argument,
is formed by ORing together some things.
For the encryption direction OR in either
For software versus hardware
encryption, OR in either
is specified, and there is no hardware, then the encryption is performed
in software and the routine returns
is the 8-byte initialization
vector for the chaining.
It is updated to the next initialization
vector upon return.
Encryption succeeded, but done in software instead of the requested hardware.
An error occurred in the hardware or driver.
Bad argument to routine.
Given a result status
is false only for the first two statuses.
These routines are present in libc 4.6.27 and later, and in
glibc 2.1 and later.
Not in POSIX.1-2001.
This page is part of release 3.54 of the Linux
A description of the project,
and information about reporting bugs,
can be found at
- RETURN VALUE
- CONFORMING TO
- SEE ALSO
This document was created by
using the manual pages.
Time: 09:52:49 GMT, January 24, 2018