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$"). Signed-off-by: Konstantin Shemyak <konstantin@xxxxxxxxxxx> --- 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 -- 2.7.4 -- To unsubscribe from this list: send the line "unsubscribe linux-man" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html