Re: [PATCH v2 2/3] crypt.3: clarified that ending of the salt string with '$' is optional
From: Michael Kerrisk (man-pages) <hidden>
Date: 2017-09-05 18:16:27
On 09/04/2017 08:53 PM, Konstantin Shemyak wrote:
In crypt/sha512-crypt.c::__sha512_crypt_r() and the similar sha256 function,
the length of the actually used salt is calculated as:
salt_len = MIN (strcspn (salt, "$"), SALT_LEN_MAX);
Thus the trailing '$' is optional in the salt string. One can check that
crypt("key", "$5$salt")
yields the same result as
crypt("key", "$5$salt$").Thanks, Konstantin. Applied. Cheers, Michael
quoted hunk
Signed-off-by: Konstantin Shemyak <redacted> --- man3/crypt.3 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)diff --git a/man3/crypt.3 b/man3/crypt.3 index 749a636..58fd33f 100644 --- a/man3/crypt.3 +++ b/man3/crypt.3@@ -195,15 +195,15 @@ encryption algorithms. If .I salt is a character string starting with the characters "$\fIid\fP$" -followed by a string terminated by "$": +followed by a string optionally terminated by "$", +then the result has the form: .RS .PP $\fIid\fP$\fIsalt\fP$\fIencrypted\fP .PP .RE -then instead of using the DES machine, .I id -identifies the encryption method used and this then determines how the rest +identifies the encryption method used instead of DES and this then determines how the rest of the password string is interpreted. The following values of .I id
-- Michael Kerrisk Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/ Linux/UNIX System Programming Training: http://man7.org/training/ -- To unsubscribe from this list: send the line "unsubscribe linux-man" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html