1crypt(3C)                Standard C Library Functions                crypt(3C)
2
3
4

NAME

6       crypt - string encoding function
7

SYNOPSIS

9       #include <crypt.h>
10
11       char *crypt(const char *key, const char *salt);
12
13
14   Standard conforming
15       #include <unistd.h>
16
17       char *crypt(const char *key, const char *salt);
18
19

DESCRIPTION

21       The  crypt()  function  encodes  strings suitable for secure storage as
22       passwords. It generates the password hash given the key and salt.
23
24
25       The key argument is the plain text password to be encrypted.
26
27
28       If the first character of salt is "$", crypt()  uses  crypt.conf(4)  to
29       determine  which  shared  module  to load for the encryption algorithm.
30       The algorithm name crypt() uses to search in crypt.conf is  the  string
31       between  the  first  and second "$", or between the first "$" and first
32       "," if a "," comes before the second "$".
33
34
35       If the first character of salt is not "$", the algorithm  described  on
36       crypt_unix(5) is used.
37

RETURN VALUES

39       Upon  successful  completion,  crypt() returns a pointer to the encoded
40       string. Otherwise it returns a null pointer and sets errno to  indicate
41       the error.
42
43
44       The  return  value  points  to  static data that is overwritten by each
45       call.
46

ERRORS

48       The crypt() function will fail if:
49
50       EINVAL     An entry in crypt.conf is invalid.
51
52
53       ELIBACC    The required shared library was not found.
54
55
56       ENOMEM     There is insufficient memory to generate the hash.
57
58
59       ENOSYS     The functionality is not supported on this system.
60
61

USAGE

63       The values returned by this function might not be portable among  stan‐
64       dard-conforming systems. See standards(5).
65
66
67       Applications  should  not use crypt() to store or verify user passwords
68       but should use the functions described on pam(3PAM) instead.
69

ATTRIBUTES

71       See attributes(5) for descriptions of the following attributes:
72
73
74
75
76       ┌─────────────────────────────┬─────────────────────────────┐
77       │      ATTRIBUTE TYPE         │      ATTRIBUTE VALUE        │
78       ├─────────────────────────────┼─────────────────────────────┤
79       │Interface Stability          │Standard                     │
80       ├─────────────────────────────┼─────────────────────────────┤
81       │MT-Level                     │MT-Safe                      │
82       └─────────────────────────────┴─────────────────────────────┘
83

SEE ALSO

85       passwd(1),   crypt_genhash_impl(3C),   crypt_gensalt(3C),    crypt_gen‐
86       salt_impl(3C), getpassphrase(3C), pam(3PAM), passwd(4), policy.conf(4),
87       attributes(5), crypt_unix(5), standards(5)
88
89
90
91SunOS 5.11                        28 Sep 2004                        crypt(3C)
Impressum