Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

crypt(3c) [opensolaris man page]

crypt(3C)						   Standard C Library Functions 						 crypt(3C)

NAME
crypt - string encoding function SYNOPSIS
#include <crypt.h> char *crypt(const char *key, const char *salt); Standard conforming #include <unistd.h> char *crypt(const char *key, const char *salt); DESCRIPTION
The crypt() function encodes strings suitable for secure storage as passwords. It generates the password hash given the key and salt. The key argument is the plain text password to be encrypted. If the first character of salt is "$", crypt() uses crypt.conf(4) to determine which shared module to load for the encryption algorithm. The algorithm name crypt() uses to search in crypt.conf is the string between the first and second "$", or between the first "$" and first "," if a "," comes before the second "$". If the first character of salt is not "$", the algorithm described on crypt_unix(5) is used. RETURN VALUES
Upon successful completion, crypt() returns a pointer to the encoded string. Otherwise it returns a null pointer and sets errno to indicate the error. The return value points to static data that is overwritten by each call. ERRORS
The crypt() function will fail if: EINVAL An entry in crypt.conf is invalid. ELIBACC The required shared library was not found. ENOMEM There is insufficient memory to generate the hash. ENOSYS The functionality is not supported on this system. USAGE
The values returned by this function might not be portable among standard-conforming systems. See standards(5). Applications should not use crypt() to store or verify user passwords but should use the functions described on pam(3PAM) instead. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Interface Stability |Standard | +-----------------------------+-----------------------------+ |MT-Level |MT-Safe | +-----------------------------+-----------------------------+ SEE ALSO
passwd(1), crypt_genhash_impl(3C), crypt_gensalt(3C), crypt_gensalt_impl(3C), getpassphrase(3C), pam(3PAM), passwd(4), policy.conf(4), attributes(5), crypt_unix(5), standards(5) SunOS 5.11 28 Sep 2004 crypt(3C)

Check Out this Related Man Page

crypt_unix(5)						Standards, Environments, and Macros					     crypt_unix(5)

NAME
crypt_unix - traditional UNIX crypt algorithm DESCRIPTION
The crypt_unix algorithm is the traditional UNIX crypt algorithm. It is not considered sufficiently secure for current systems and is pro- vided for backwards compatibility. The crypt_sunmd5(5), crypt_bsdmd5(5), or crypt_bsdbf(5) algorithm should be used instead. The algorithm identifier for policy.conf(4) is __unix__. There is no entry in crypt.conf(4) for this algorithm. The crypt_unix algorithm is internal to libc and provides the string encoding function used by crypt(3C) when the first character of the salt is not a "$". This algorithm is based on a one-way encryption algorithm with variations intended (among other things) to frustrate use of hardware imple- mentations of a key search. Only the first eight characters of the key passed to crypt() are used with this algorithm; the rest are silently ignored. The salt is a two-character string chosen from the set [a-zA-Z0-9./]. This string is used to perturb the hashing algo- rithm in one of 4096 different ways. The maximum password length for crypt_unix is 8 characters. USAGE
The return value of the crypt_unix algorithm might not be portable among standard-conforming systems. See standards(5). ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |MT-Level |Safe | +-----------------------------+-----------------------------+ SEE ALSO
passwd(1), crypt(3C), crypt_genhash_impl(3C), crypt_gensalt(3C), crypt_gensalt_impl(3C), getpassphrase(3C), crypt.conf(4), passwd(4), pol- icy.conf(4), attributes(5), crypt_bsdbf(5), crypt_bsdmd5(5), crypt_sunmd5(5), standards(5) SunOS 5.10 6 Aug 2003 crypt_unix(5)
Man Page