[PATCH v1] man/man3/crypt.3: These functions accept many algorithms, not only DES
Rich Felker
dalias@libc.org
Thu Nov 12 02:53:39 GMT 2026
On Thu, Nov 12, 2026 at 02:52:23AM +0100, Vincent Lefevre wrote:
> Hi,
>
> On 2026-11-10 01:01:19 +0100, Alejandro Colomar wrote:
> > $ MANWIDTH=64 diffman-git -U99 HEAD
> > --- HEAD^:man/man3/crypt.3
> > +++ HEAD:man/man3/crypt.3
> [...]
> > STANDARDS
> > crypt()
> > POSIX.1‐2008.
> [...]
> > NOTES
> > - Features in glibc
> > - The glibc version of this function supports additional
> > - hashing algorithms.
> > -
> > + salt
> > If salt is a character string starting with the characters
> > "$id$" followed by a string optionally terminated by "$",
> > then the result has the form:
> >
> > $id$salt$hashed
> [...]
>
> The "$" character is disallowed by POSIX (in 2008 and still in the
> current edition) in the salt argument:
>
> https://pubs.opengroup.org/onlinepubs/9699919799.2008edition/functions/crypt.html
> https://pubs.opengroup.org/onlinepubs/9799919799/functions/crypt.html
>
> (this breaks a "shall").
>
> I think that something should be said about that.
That's the whole reason '$' was chosen: POSIX doesn't define the
behavior (since a "shall" is violated) so the implementation is free
to define a behavior here. The behaviors for the portable base64
character set documented in POSIX uses only 2 characters as salt
(insufficient) and the common agreed-upon definition for how they are
used is as salt for the classic DES-based password hash.
Rich
More information about the Libc-alpha
mailing list