|
|
Message-ID: <20261111211313.GF5716@brightrain.aerifal.cx> Date: Wed, 11 Nov 2026 16:13:13 -0500 From: Rich Felker <dalias@...c.org> To: Alejandro Colomar <alx+linux-man@...nel.org> Cc: "Serge E. Hallyn" <serge@...lyn.com>, Alejandro Colomar <alx@...nel.org>, linux-man@...r.kernel.org, libc-alpha@...rceware.org, Walter Harms <wharms@....de>, ~hallyn/shadow@...ts.sr.ht, musl@...ts.openwall.com Subject: Re: Re: [PATCH v1] man/man3/crypt.3: These functions accept many algorithms, not only DES On Wed, Nov 11, 2026 at 07:55:01PM +0100, Alejandro Colomar wrote: > Hi Serge, > > > Date: 2026-11-11 09:05:40-0600 > > From: "Serge E. Hallyn" <serge@...lyn.com> > > > [...] > > > - salt is a two‐character string chosen from the set > > > - [a-zA-Z0-9./]. This string is used to perturb the algo‐ > > > - rithm in one of 4096 different ways. > > > - > > > - By taking the lowest 7 bits of each of the first eight > > > - characters of the 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 print‐ > > > - able ASCII characters (the first two characters represent > > > - the salt itself). The return value points to static data > > > - whose content is overwritten by each call. > > > - > > > - Warning: the key space consists of 2**56 equal 7.2e16 pos‐ > > > - sible values. Exhaustive searches of this key space are > > > - possible using massively parallel computers. Software, > > > - such as crack(1), is available which will search the por‐ > > > - tion of this key space that is generally used by humans > > > - for passwords. Hence, password selection should, at mini‐ > > > - mum, avoid common words and names. The use of a passwd(1) > > > - program that checks for crackable passwords during the se‐ > > > - lection process is recommended. > > > - > > > - The DES algorithm itself has a few quirks which make the > > > - use of the crypt() interface a very poor choice for any‐ > > > - thing other than password authentication. If you are > > > - planning on using the crypt() interface for a cryptography > > > - project, don’t do it: get a good book on encryption and > > > - one of the widely available DES libraries. > > > + salt is a string used for determining the hasing algorithm > > > > typo: hashing > > Thanks! Fixed. > > > > + (possibly including parameters). It is also used to per‐ > > > + turb the algorithm. > > BTW, I suspect the salt is not used for perturbing the algorithm > anymore. From musl's source code, at least for SHA-512, I _think_ it's > not reading past the third '$', and thus it's not reading any random-ish > bytes. > > Should I drop the second sentence? I'm not sure where you're getting this from. All implementations of the same password hash function need to produce the same result, or user credentials would not be portable between different ones. And a password hash that does not use any salt would not be fit for purpose. In musl's crypt_sha512.c, the salt is isolated from the setting string in lines 262-266 and used in the sha512_update operations that follow. Rich
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.