ENCRYPT(3P)
π ENCRYPT(3P) β the POSIX Programmer's Manual girlie π
okay bestie, so this is encrypt(3P) from the POSIX Programmer's Manual (IEEE/The Open Group, 2017 β more on that at the bottom π). Sit down, hydrate, let's get into it.
β¨ PROLOG β¨
so like, this page is part of the POSIX Programmer's Manual. The Linux implementation of this interface may differ (consult the corresponding Linux manual page for details of Linux behavior), or the interface may not be implemented on Linux. π yeah. it's giving "maybe not even here."
π NAME π
encrypt β encoding function (CRYPT)
like. that's the name. it encodes. it's part of CRYPT. periodt.
πΈ SYNOPSIS πΈ
#include <unistd.h>
void encrypt(char block[64], int edflag);
two arguments, no return value, no drama (well, some drama, see ERRORS).
π¦ DESCRIPTION π¦
okay so encrypt() shall provide access to an implementation-defined encoding algorithm. note that: implementation-defined. it's not telling you what the algorithm is, it's just telling you there is one. the key generated by setkey() is used to encrypt the string block with encrypt().
the block argument to encrypt() shall be an array of length 64 bytes containing only the bytes with values of 0 and 1. yes bestie, only 0s and 1s. bit values, not characters, not vibes. the array is modified in place to a similar array using the key set by setkey().
now the flag, because there's always a flag:
- if
edflagis0, the argument is encoded β¨ - if
edflagis1, the argument may be decoded (see the APPLICATION USAGE section, it's important i promise); if the argument is not decoded,errnoshall be set to[ENOSYS].
π¨ and here's the sneaky part:encrypt()shall not change the setting oferrnoif successful. so if you wanna actually catch errors, an application wishing to check for error situations should seterrnoto0before callingencrypt(). iferrnois non-zero on return, an error has occurred. set it to zero first or you're just reading stale vibes, fr fr.
also: the encrypt() function need not be thread-safe. ngl that's a bit of a red flag but it is what it is. π
π« RETURN VALUE π«
the encrypt() function shall not return a value. it's void. it gives you nothing back. it just changes your array. main character energy honestly, doing the work and taking zero credit. π
π₯ ERRORS π₯
the encrypt() function shall fail if:
ENOSYSβ the functionality is not supported on this implementation. like, it's just not here bestie. π«Ά
the following sections are informative. (translation: the standard said "this part is just lore, not law" β¨)
π EXAMPLES π
None. π yeah. nothing. zero examples. we're on our own, bestie. good luck out there.
π§ APPLICATION USAGE π§
historical implementations of the encrypt() function used a rather primitive encoding algorithm. so like. don't build your whole security model on this, okay? i'm just the messenger. π
in some environments, decoding might not be implemented. this is related to some Government restrictions on encryption and decryption routines. historical practice has been to ship a different version of the encryption library without the decryption feature in the routines supplied. thus the exported version of encrypt() does encoding but not decoding.
so when edflag is 1? yeah. that's the "may be decoded" from before. it might not be. that's why [ENOSYS] exists. iykyk. π
π RATIONALE π
None. nothing. the rationale section said "no thoughts, head empty." π
β FUTURE DIRECTIONS β
a future version of the standard may mark this interface as obsolete or remove it altogether. so like... this whole page might get yeeted from the standard one day. π not to be dramatic but that's exactly what it says. enjoy it while it lasts bestie.
π SEE ALSO π
crypt()setkey()
and from The Base Definitions volume of POSIX.1β2017: <unistd.h> β that's where the #include comes from, obviously. β¨
πΈ COPYRIGHT πΈ
okay so legal time, but make it cute:
Portions of this text are reprinted and reproduced in electronic form from IEEE Std 1003.1-2017, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 7, 2018 Edition, Copyright (C) 2018 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between this version and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html .
Any typographical or formatting errors that appear in this page are most likely to have been introduced during the conversion of the source files to man page format. To report such errors, see https://www.kernel.org/doc/man-pages/reporting_bugs.html .
π«Ά bestie disclaimer: if this version and the real IEEE/The Open Group Standard ever disagree, the Standard wins. it's the referee. i'm just the hype girl.
and that's the page!! IEEE/The Open Group, 2017, ENCRYPT(3P) β slay, stay encoded, and set your errno to 0 before you call anything. πβ¨ππ¦πΈ
π¦ where this page comes from
- alpine 3.22: man-pages-posix 2017a-r0 Β· custom
- alpine 3.23: man-pages-posix 2017a-r0 Β· custom
- alpine 3.24: man-pages-posix 2017a-r0 Β· custom
- arch rolling: man-pages 6.19-1
- arch rolling: man-pages 6.20-1 Β· BSD-2-Clause AND BSD-3-Clause AND BSD-4.3TAHOE AND BSD-4-Clause-UC AND GPL-1.0-or-later AND GPL-2.0-only AND GPL-2.0-or-later AND GPL-3.0-or-later AND LGPL-3.0-linking-exception AND LGPL-3.0-or-later AND LicenseRef-Public-Domain AND LicenseRef-UltraPermissive AND Linux-man-pages-1-para AND Linux-man-pages-copyleft AND Linux-man-pages-copyleft-2-para AND Linux-man-pages-copyleft-var AND MIT AND Spencer-94
- nixpkgs unstable: man-pages-posix 2017a
- opensuse-leap 16.0: man-pages-posix 2017a-160000.4.1 Β· SUSE-IEEE
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms