All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1] man/man3/crypt.3: These functions accept many algorithms, not only DES
@ 2026-11-09 23:58 Alejandro Colomar
  2026-11-10  0:01 ` Alejandro Colomar
  0 siblings, 1 reply; 29+ messages in thread
From: Alejandro Colomar @ 2026-11-09 23:58 UTC (permalink / raw)
  To: linux-man
  Cc: Alejandro Colomar, libc-alpha, Walter Harms, Rich Felker,
	~hallyn/shadow, musl

[-- Attachment #1: Type: text/plain, Size: 5146 bytes --]

This page was written as if DES was the only portable algorithm, and
glibc was a weird one supporting other algorithms.  These days (and
since a long time ago), DES has been long deprecated, and crypt(3)
supports many algorithms in all systems.

Signed-off-by: Alejandro Colomar <alx@kernel.org>
---

Hi!

The patch for documenting the detail about "*" will come later.
This was a cleanup that seemed necessary before doing that.
Let me know what you think about it.  I'll reply with a copy of the
formatted page, so you don't need to apply the patch to review it.


Have a lovely night!
Alex

 man/man3/crypt.3 | 84 ++++--------------------------------------------
 1 file changed, 6 insertions(+), 78 deletions(-)

diff --git a/man/man3/crypt.3 b/man/man3/crypt.3
index 7c9a50a534b7..6c0511240898 100644
--- a/man/man3/crypt.3
+++ b/man/man3/crypt.3
@@ -47,56 +47,21 @@ .SH SYNOPSIS
 .SH DESCRIPTION
 .BR crypt ()
 is the password hashing function.
-It is based on the Data Encryption
-Standard algorithm with variations intended (among other things) to
-discourage use of hardware implementations of a key search.
 .P
 .I key
 is a user's typed password.
 .P
 .I salt
-is a two-character string chosen from the set
-.RB [ a\-zA\-Z0\-9./ ].
-This string is used to
-perturb the algorithm in one of 4096 different ways.
+is a string
+used for determining the hasing algorithm
+(possibly including parameters).
+It is also used to perturb the algorithm.
 .P
-By taking the lowest 7 bits of each of the first eight characters of the
-.IR key ,
-a 56-bit key is obtained.
-This 56-bit key is used to encrypt repeatedly a
-constant string (usually a string consisting of all zeros).
 The returned
-value points to the hashed password, a series of 13 printable ASCII
-characters (the first two characters represent the salt itself).
+value points to the hashed password.
 The return value points to static data whose content is
 overwritten by each call.
 .P
-Warning: the key space consists of
-.if t 2\s-2\u56\s0\d
-.if n 2**56
-equal 7.2e16 possible values.
-Exhaustive searches of this key space are
-possible using massively parallel computers.
-Software, such as
-.BR crack (1),
-is available which will search the portion of this key space that is
-generally used by humans for passwords.
-Hence, password selection should,
-at minimum, avoid common words and names.
-The use of a
-.BR passwd (1)
-program that checks for crackable passwords during the selection process is
-recommended.
-.P
-The DES algorithm itself has a few quirks which make the use of the
-.BR crypt ()
-interface a very poor choice for anything other than password
-authentication.
-If you are planning on using the
-.BR crypt ()
-interface for a cryptography project, don't do it: get a good book on
-encryption and one of the widely available DES libraries.
-.P
 .BR crypt_r ()
 is a reentrant version of
 .BR crypt ().
@@ -122,40 +87,6 @@ .SH ERRORS
 .BR crypt ()
 function was not implemented,
 probably because of U.S.A.\& export restrictions.
-.\" The following level of detail is not necessary in this man page.
-.\" .P
-.\" When encrypting a plain text P using DES with the key K results in the
-.\" encrypted text C, then the complementary plain text P' being encrypted
-.\" using the complementary key K' will result in the complementary encrypted
-.\" text C'.
-.\" .P
-.\" Weak keys are keys which stay invariant under the DES key transformation.
-.\" The four known weak keys 0101010101010101, fefefefefefefefe,
-.\" 1f1f1f1f0e0e0e0e and e0e0e0e0f1f1f1f1 must be avoided.
-.\" .P
-.\" There are six known half weak key pairs, which keys lead to the same
-.\" encrypted data.  Keys which are part of such key clusters should be
-.\" avoided.
-.\" Sorry, I could not find out what they are.
-.\""
-.\" .P
-.\" Heavily redundant data causes trouble with DES encryption, when used in the
-.\" .I codebook
-.\" mode that
-.\" .BR crypt ()
-.\" implements.  The
-.\" .BR crypt ()
-.\" interface should be used only for its intended purpose of password
-.\" verification, and should not be used as part of a data encryption tool.
-.\" .P
-.\" The first and last three output bits of the fourth S-box can be
-.\" represented as function of their input bits.  Empiric studies have
-.\" shown that S-boxes partially compute the same output for similar input.
-.\" It is suspected that this may contain a back door which could allow the
-.\" NSA to decrypt DES encrypted data.
-.\" .P
-.\" Making encrypted data computed using crypt() publicly available has
-.\" to be considered insecure for the given reasons.
 .TP
 .B EPERM
 .I /proc/sys/crypto/fips_enabled
@@ -217,10 +148,7 @@ .SS Availability in glibc
 .I libxcrypt
 is an ABI-compatible drop-in replacement.
 .SH NOTES
-.SS Features in glibc
-The glibc version of this function supports additional
-hashing algorithms.
-.P
+.SS salt
 If
 .I salt
 is a character string starting with the characters

base-commit: b951aa8a5356e12f635650d0136abed715e0d607
-- 
2.55.0


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply related	[flat|nested] 29+ messages in thread

end of thread, other threads:[~2026-11-12 22:22 UTC | newest]

Thread overview: 29+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-09 23:58 [PATCH v1] man/man3/crypt.3: These functions accept many algorithms, not only DES Alejandro Colomar
2026-11-10  0:01 ` Alejandro Colomar
2026-11-11 15:05   ` Serge E. Hallyn
2026-11-11 18:55     ` Alejandro Colomar
2026-11-11 21:13       ` [musl] " Rich Felker
2026-11-11 21:43         ` Alejandro Colomar
2026-11-12  1:52   ` Vincent Lefevre
2026-11-12  2:53     ` Rich Felker
2026-11-12  3:29       ` Vincent Lefevre
2026-11-12  3:37         ` [musl] " Rich Felker
2026-11-12 10:28           ` Alejandro Colomar
2026-11-12 11:40             ` Vincent Lefevre
2026-11-12 12:08               ` Alejandro Colomar
2026-11-12 13:15                 ` Vincent Lefevre
2026-11-12 13:26                   ` Alejandro Colomar
2026-11-12 12:08             ` Rich Felker
2026-11-12 12:27               ` Alejandro Colomar
2026-11-12 12:41                 ` Szabolcs Nagy
2026-11-12 13:12                   ` Alejandro Colomar
2026-11-12 13:27                     ` Vincent Lefevre
2026-11-12 13:17                 ` Vincent Lefevre
2026-11-12 13:23                   ` Alejandro Colomar
2026-11-12 13:45                     ` Vincent Lefevre
2026-11-12 13:55                       ` Rich Felker
2026-11-12 14:07                         ` Alejandro Colomar
2026-11-12 14:43                           ` Rich Felker
2026-11-12 14:58                             ` Alejandro Colomar
2026-11-12 18:08                               ` Rich Felker
2026-11-12 22:22                                 ` Alejandro Colomar

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.