DES_CRYPT(3)
π DES_CRYPT(3) π
okay bestie, welcome to the DES crypt page β it lives in the Library Functions Manual and it's literally all about fast DES encryption. yes, that DES. the Data Encryption Standard one. buckle up π
β¨ NAME β¨
des_crypt, ecb_crypt, cbc_crypt, des_setparity β fast DES encryption π
β¨ SYNOPSIS β¨
#include <rpc/des_crypt.h>
int
ecb_crypt(char *key, char *data, unsigned datalen, unsigned mode);
int
cbc_crypt(char *key, char *data, unsigned datalen, unsigned mode,
char *ivec);
void
des_setparity(char *key);
β¨ DESCRIPTION β¨
so ecb_crypt() and cbc_crypt() are the ones implementing the NBS DES (Data Encryption Standard) π¦. these routines are faster and more general purpose than crypt(3), no cap. and here's the slay part β they can also utilize DES hardware if it's available. main character energy fr.
ecb_crypt()encrypts in ECB (Electronic Code Book) mode, which encrypts blocks of data independently.cbc_crypt()encrypts in CBC (Cipher Block Chaining) mode, which chains together successive blocks. CBC mode protects against insertions, deletions and substitutions of blocks. also, regularities in the clear text will not appear in the cipher text. iconic behaviour honestly β¨
here's how you actually use these routines, bestie, pay attention:
- the first argument,
key, is the 8-byte encryption key with parity. to set the key's parity β which for DES is in the low bit of each byte β usedes_setparity(). - the second argument,
data, contains the data to be encrypted or decrypted. - the third argument,
datalen, is the length in bytes ofdata, and it must be a multiple of 8. like, mandatory. do not play with this one π - the fourth argument,
mode, is formed by OR'ing together some things:- for the encryption direction, OR in either
DES_ENCRYPTorDES_DECRYPT. - for software versus hardware encryption, OR in either
DES_HWorDES_SW. - if
DES_HWis specified, and there is no hardware, then the encryption is performed in software and the routine returnsDESERR_NOHWDEVICE. so it still works, it's just doing it the software way π
- for the encryption direction, OR in either
- for
cbc_crypt(), theivecargument is the 8-byte initialization vector for the chaining. it gets updated to the next initialization vector upon return. so it's giving... in-and-out, and it remembers where it left off π
β¨ ERRORS β¨
[DESERR_NONE]β no error. we love a clean run π«Ά[DESERR_NOHWDEVICE]β encryption succeeded, but done in software instead of the requested hardware. (it ate, just not the way you asked π)[DESERR_HWERR]β an error occurred in the hardware or driver.[DESERR_BADPARAM]β bad argument to routine. bestie. check your args.
given a result status stat, the macro DES_FAILED(stat) is false only for the first two statuses. so if you're checking for failure, that's your vibe check right there π
β¨ AVAILABILITY β¨
the ecb_crypt(), cbc_crypt(), and des_setparity() functions are part of libtirpc π
β¨ SEE ALSO β¨
β¨ RESTRICTIONS β¨
these routines are not available in RPCSRC 4.0. this information is provided to describe the DES interface expected by Secure RPC.
so yeah, not available there. don't come for me, that's just the facts πΈ
mwah π that's the whole page. this one shipped out with Debian, dated October 6, 1987 β yeah, an actual vintage. periodt. ππ
π¦ where this page comes from
- alpine 3.22: libtirpc-doc 1.3.5-r0 Β· BSD-3-Clause
- alpine 3.23: libtirpc-doc 1.3.5-r1 Β· BSD-3-Clause
- alpine 3.24: libtirpc-doc 1.3.5-r1 Β· BSD-3-Clause
- arch rolling: libtirpc 1.3.8-1 Β· SISSL AND BSD-3-Clause
- centos-stream 10: libtirpc-devel 1.3.5-1.el10 Β· SISSL AND BSD-3-Clause
- centos-stream 9: libtirpc-devel 1.3.3-9.el9 Β· SISSL and BSD
- centos-stream 9: libtirpc-devel 1.3.3-9.el9 Β· SISSL and BSD
- debian bookworm: libtirpc-dev 1.3.3+ds-1 Β· BSD-3-Clause
- debian trixie: libtirpc-dev 1.3.6+ds-1 Β· BSD-3-Clause
- fedora 43: libtirpc-devel 1.3.7-0.fc43 Β· SISSL AND BSD-3-Clause
- fedora 43: libtirpc-devel 1.3.7-0.fc43 Β· SISSL AND BSD-3-Clause
- fedora 43: libtirpc-devel 1.3.7-1.rc1.fc43 Β· SISSL AND BSD-3-Clause
- fedora 43: libtirpc-devel 1.3.7-1.rc1.fc43 Β· SISSL AND BSD-3-Clause
- fedora 44: libtirpc-devel 1.3.7-2.fc44 Β· SISSL AND BSD-3-Clause
- fedora 44: libtirpc-devel 1.3.7-2.fc44 Β· SISSL AND BSD-3-Clause
- fedora 44: libtirpc-devel 1.3.8-0.fc44 Β· SISSL AND BSD-3-Clause
- fedora 44: libtirpc-devel 1.3.8-0.fc44 Β· SISSL AND BSD-3-Clause
- nixos 26.05: libtirpc 1.3.7
- nixpkgs unstable: libtirpc 1.3.7
- opensuse-leap 16.0: libtirpc-devel 1.3.6-160000.2.2 Β· BSD-3-Clause
- opensuse-leap 16.0: libtirpc-devel 1.3.6-160000.2.2 Β· BSD-3-Clause
- opensuse-leap 16.0: libtirpc-devel 1.3.6-160000.2.2 Β· BSD-3-Clause
- opensuse-leap 16.0: libtirpc-devel 1.3.6-160000.2.2 Β· BSD-3-Clause
- ubuntu jammy: libtirpc-dev 1.3.2-2build1 Β· BSD-3-Clause
- ubuntu jammy: libtirpc-dev 1.3.2-2ubuntu0.1 Β· BSD-3-Clause
- ubuntu noble: libtirpc-dev 1.3.4+ds-1.1build1 Β· BSD-3-Clause
- ubuntu questing: libtirpc-dev 1.3.6+ds-1
- ubuntu resolute: libtirpc-dev 1.3.7-0.1 Β· BSD-3-Clause
- ubuntu stonking: libtirpc-dev 1.3.7+ds-1 Β· BSD-3-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms