| Summary: | length of salt in crypt() is not the same as described in man 3 crypt | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | Base System | Reporter: | andre <andre> | ||||||
| Component: | bin | Assignee: | freebsd-bugs (Nobody) <bugs> | ||||||
| Status: | Closed FIXED | ||||||||
| Severity: | Affects Only Me | ||||||||
| Priority: | Normal | ||||||||
| Version: | 4.2-STABLE | ||||||||
| Hardware: | Any | ||||||||
| OS: | Any | ||||||||
| Attachments: |
|
||||||||
State Changed From-To: open->closed This is a documentation bug, not a code bug, and it was fixed with PR docs/36782. |
man 3 crypt: Modular crypt: If the salt begins with the string $digit$ then the Modular Crypt Format is used. The digit represents which algorithm is used in encryption. Following the token is the actual salt to use in the encryption. The length of the salt is limited to 16 characters--because the length of the ^^^^^^^^^^^^^^^^^^^^^ returned output is also limited (_PASSWORD_LEN). The salt must be termi- nated with the end of the string (NULL) or a dollar sign. Any characters after the dollar sign are ignored. Currently supported algorithms are: 1 MD5 =========================================================== In reality length of salt is limited to 8 characters. How-To-Repeat: $cat crp.c #include <unistd.h> #include <stdio.h> main () { char passwd[]="testpasswd"; char salt[]="$1$1234567890$"; char *hash; hash = crypt(passwd, salt); printf("%s\n", hash); } $cc -o crp crp.c -lcrypt $./crp $1$12345678$VYreJG4qkG1D4.4X8s6o41