hcrypto_des(3)
π hcrypto_des β DES crypto functions π
okay bestie, sit DOWN, because this is the hcrypto_des(3) page from the Heimdal crypto library and it's literally the whole DES situation. old-school, iconic, slightly cursed, we love her π
β¨ NAME β¨
hcrypto_des β DES crypto functions
πΈ SYNOPSIS πΈ
π Functions π
void DES_set_odd_parity (DES_cblock *key)
int HC_DEPRECATED DES_check_key_parity (DES_cblock *key)
int DES_is_weak_key (DES_cblock *key)
int HC_DEPRECATED DES_set_key (DES_cblock *key, DES_key_schedule *ks)
int DES_set_key_unchecked (DES_cblock *key, DES_key_schedule *ks)
int DES_set_key_checked (DES_cblock *key, DES_key_schedule *ks)
int DES_key_sched (DES_cblock *key, DES_key_schedule *ks)
void DES_encrypt (uint32_t u[2], DES_key_schedule *ks, int encp)
void DES_ecb_encrypt (DES_cblock *input, DES_cblock *output,
DES_key_schedule *ks, int encp)
void DES_cbc_encrypt (const void *in, void *out, long length,
DES_key_schedule *ks, DES_cblock *iv, int encp)
void DES_pcbc_encrypt (const void *in, void *out, long length,
DES_key_schedule *ks, DES_cblock *iv, int encp)
void DES_ecb3_encrypt (DES_cblock *input, DES_cblock *output,
DES_key_schedule *ks1, DES_key_schedule *ks2, DES_key_schedule *ks3,
int encp)
void DES_ede3_cbc_encrypt (const void *in, void *out, long length,
DES_key_schedule *ks1, DES_key_schedule *ks2, DES_key_schedule *ks3,
DES_cblock *iv, int encp)
void DES_cfb64_encrypt (const void *in, void *out, long length,
DES_key_schedule *ks, DES_cblock *iv, int *num, int encp)
uint32_t DES_cbc_cksum (const void *in, DES_cblock *output, long length,
DES_key_schedule *ks, DES_cblock *iv)
void DES_string_to_key (const char *str, DES_cblock *key)
int HC_DEPRECATED DES_new_random_key (DES_cblock *key)
void HC_DEPRECATED DES_init_random_number_generator (DES_cblock *seed)
void HC_DEPRECATED DES_random_key (DES_cblock *key)
π¦ Detailed Description π¦
See the DES - Data Encryption Standard crypto interface for description and examples. β¨ iykyk, that's where the actual lore lives π
π Function Documentation π
π uint32_t DES_cbc_cksum (const void * in, DES_cblock * output, long length, DES_key_schedule * ks, DES_cblock * iv)
Creates a checksum using DES in CBC encryption mode. okay so bestie, heads up: this mode is only used for Kerberos 4, and it should stay that way. fr fr, do not go expanding her horizons π«Ά
The IV must always be different for different input data blocks. no cap π«
Parameters
inβ data to checksumoutputβ the checksumlengthβ length of dataksβ key schedule to useivβ initial vector to use
π void DES_cbc_encrypt (const void * in, void * out, long length, DES_key_schedule * ks, DES_cblock * iv, int encp)
Encrypt/decrypt a block using DES in Chain Block Cipher mode (cbc). π
The IV must always be different for different input data blocks. the way that matters π
Parameters
inβ data to encryptoutβ data to encryptlengthβ length of dataksβ key schedule to useivβ initial vector to useencpβ if non zero, encrypt. if zero, decrypt.
π void DES_cfb64_encrypt (const void * in, void * out, long length, DES_key_schedule * ks, DES_cblock * iv, int * num, int encp)
Encrypt/decrypt using DES in cipher feedback mode with 64 bit feedback. slay π
The IV must always be different for different input data blocks. π¦
Parameters
inβ data to encryptoutβ data to encryptlengthβ length of dataksβ key schedule to useivβ initial vector to usenumβ offset into in cipher block encryption/decryption stop last time.encpβ if non zero, encrypt. if zero, decrypt.
π int HC_DEPRECATED DES_check_key_parity (DES_cblock * key)
Check if the key have correct parity. note the HC_DEPRECATED, bestie β she's marked deprecated, so she's giving legacy energy π
Parameters
keyβ key to check the parity.
Returns
1on success,0on failure.
π void DES_ecb3_encrypt (DES_cblock * input, DES_cblock * output, DES_key_schedule * ks1, DES_key_schedule * ks2, DES_key_schedule * ks3, int encp)
Encrypt/decrypt a block using triple DES using EDE mode, encrypt/decrypt/encrypt. three keys, three schedules, main character energy π
Parameters
inputβ data to encryptoutputβ data to encryptks1β key schedule to useks2β key schedule to useks3β key schedule to useencpβ if non zero, encrypt. if zero, decrypt.
π void DES_ecb_encrypt (DES_cblock * input, DES_cblock * output, DES_key_schedule * ks, int encp)
Encrypt/decrypt a block using DES. classic, iconic, the original π
Parameters
inputβ data to encryptoutputβ data to encryptksβ key schedule to useencpβ if non zero, encrypt. if zero, decrypt.
π void DES_ede3_cbc_encrypt (const void * in, void * out, long length, DES_key_schedule * ks1, DES_key_schedule * ks2, DES_key_schedule * ks3, DES_cblock * iv, int encp)
Encrypt/decrypt using Triple DES in Chain Block Cipher mode (cbc). β¨
The IV must always be different for different input data blocks. periodt π
Parameters
inβ data to encryptoutβ data to encryptlengthβ length of dataks1β key schedule to useks2β key schedule to useks3β key schedule to useivβ initial vector to useencpβ if non zero, encrypt. if zero, decrypt.
π void DES_encrypt (uint32_t u[2], DES_key_schedule * ks, int encp)
Encrypt/decrypt a block using DES. Also called ECB mode πΈ
Parameters
uβ data to encryptksβ key schedule to useencpβ if non zero, encrypt. if zero, decrypt.
π void HC_DEPRECATED DES_init_random_number_generator (DES_cblock * seed)
Seed the random number generator. Deprecated, use RAND - random number π«Ά bestie pls stop using this one, she's retired π
Parameters
seedβ a seed to seed that random number generate with.
π int DES_is_weak_key (DES_cblock * key)
Checks if the key is any of the weaks keys that makes DES attacks trival. π yeah. she said trivial, and she meant it.
Parameters
keyβ key to check.
Returns
1if the key is weak,0otherwise.
π int DES_key_sched (DES_cblock * key, DES_key_schedule * ks)
Compatibility function for eay libdes, works just like DES_set_key_checked(). nostalgia-core π
Parameters
keyβ a key to initialize the key schedule with.ksβ a key schedule to initialize.
Returns
0on success,-1on invalid parity,-2on weak key.
π int HC_DEPRECATED DES_new_random_key (DES_cblock * key)
Generate a random des key using a random block, fixup parity and skip weak keys. marked HC_DEPRECATED, so proceed accordingly π
Parameters
keyβ is set to a random key.
Returns
0on success, non zero on random number generator failure.
π void DES_pcbc_encrypt (const void * in, void * out, long length, DES_key_schedule * ks, DES_cblock * iv, int encp)
Encrypt/decrypt a block using DES in Propagating Cipher Block Chaining mode. okay so again: this mode is only used for Kerberos 4, and it should stay that way. do not touch, do not expand, do not romanticize π«π
The IV must always be different for different input data blocks.
Parameters
inβ data to encryptoutβ data to encryptlengthβ length of dataksβ key schedule to useivβ initial vector to useencpβ if non zero, encrypt. if zero, decrypt.
π void HC_DEPRECATED DES_random_key (DES_cblock * key)
Generate a random key, deprecated since it doesn't return an error code, use DES_new_random_key(). no error code = no closure, and that's why she's deprecated π
Parameters
keyβ is set to a random key.
π int HC_DEPRECATED DES_set_key (DES_cblock * key, DES_key_schedule * ks)
Setup a des key schedule from a key. Deprecated function, use DES_set_key_unchecked() or DES_set_key_checked() instead. bestie, pick one of the cool ones π«Ά
Parameters
keyβ a key to initialize the key schedule with.ksβ a key schedule to initialize.
Returns
0on success
π int DES_set_key_checked (DES_cblock * key, DES_key_schedule * ks)
Just like DES_set_key_unchecked() except checking that the key is not weak for or have correct parity. she's the one who actually does the vibe check β
Parameters
keyβ a key to initialize the key schedule with.ksβ a key schedule to initialize.
Returns
0on success,-1on invalid parity,-2on weak key.
π int DES_set_key_unchecked (DES_cblock * key, DES_key_schedule * ks)
Setup a des key schedule from a key. The key is no longer needed after this transaction and can cleared. πΈ
Does NOT check that the key is weak for or have wrong parity. okay so she does ZERO vibe checks, she just trusts you, which is lowkey terrifying π
Parameters
keyβ a key to initialize the key schedule with.ksβ a key schedule to initialize.
Returns
0on success
π void DES_set_odd_parity (DES_cblock * key)
Set the parity of the key block, used to generate a des key from a random key. See DES key generation. β¨
Parameters
keyβ key to fixup the parity for.
π void DES_string_to_key (const char * str, DES_cblock * key)
Convert a string to a DES key. Use something like PKCS5_PBKDF2_HMAC_SHA1() to create key from passwords. π pls pls pls use the KDF, i am begging π
Parameters
strβ The string to convert to a keykeyβ the resulting key
π Author π
Generated automatically by Doxygen for Heimdal crypto library from the source code. she was born in a doc generator, and honestly? that's her origin story and it ate β¨
π Sign-off π
this whole page is from Version 7.8.0, dated Tue Nov 15 2022, and it's the hcrypto_des(3) page from the Heimdal crypto library. mwah, go encrypt something responsibly bestie ππ¦π
π¦ where this page comes from
- alpine 3.22: heimdal-doc 7.8.0-r4 Β· BSD-3-Clause
- alpine 3.23: heimdal-doc 7.8.0-r5 Β· BSD-3-Clause
- alpine 3.24: heimdal-doc 7.8.0-r5 Β· BSD-3-Clause
- epel 10: heimdal-devel 7.8.0-26.el10_2 Β· BSD-2-Clause AND BSD-3-Clause AND HPND-export-US AND HPND-export2-US AND LicenseRef-Fedora-Public-Domain
- epel 9: heimdal-devel 7.8.0-5.el9 Β· BSD and MIT
- fedora 43: heimdal-devel 7.8.0-26.fc43 Β· BSD-2-Clause AND BSD-3-Clause AND HPND-export-US AND HPND-export2-US AND LicenseRef-Fedora-Public-Domain
- fedora 43: heimdal-devel 7.8.0-26.fc43 Β· BSD-2-Clause AND BSD-3-Clause AND HPND-export-US AND HPND-export2-US AND LicenseRef-Fedora-Public-Domain
- fedora 44: heimdal-devel 7.8.0-26.fc43 Β· BSD-2-Clause AND BSD-3-Clause AND HPND-export-US AND HPND-export2-US AND LicenseRef-Fedora-Public-Domain
- fedora 44: heimdal-devel 7.8.0-26.fc43 Β· BSD-2-Clause AND BSD-3-Clause AND HPND-export-US AND HPND-export2-US AND LicenseRef-Fedora-Public-Domain
- fedora 44: heimdal-devel 7.8.0-28.fc44 Β· BSD-2-Clause AND BSD-3-Clause AND HPND-export-US AND HPND-export2-US AND LicenseRef-Fedora-Public-Domain
- fedora 44: heimdal-devel 7.8.0-28.fc44 Β· BSD-2-Clause AND BSD-3-Clause AND HPND-export-US AND HPND-export2-US AND LicenseRef-Fedora-Public-Domain
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms