|
NAMEcrypt_gensalt , crypt_gensalt_rn ,
crypt_gensalt_ra —
encode settings for passphrase hashing
LIBRARYCrypt Library (libcrypt, -lcrypt)SYNOPSIS#include <crypt.h>
char *
char *
char *
DESCRIPTIONThecrypt_gensalt ,
crypt_gensalt_rn , and
crypt_gensalt_ra functions compile a string for use as
the setting argument to crypt ,
crypt_r , crypt_rn , and
crypt_ra . prefix selects the
hashing method to use. count controls the CPU time cost
of the hash; the valid range for count and the exact
meaning of “CPU time cost” depends on the hashing method, but
larger numbers correspond to more costly hashes. rbytes
should point to nrbytes cryptographically random bytes
for use as “salt.”
If prefix is a null pointer, the best available hashing method will be selected. (CAUTION: if prefix is an empty string, the “traditional” DES-based hashing method will be selected; this method is unacceptably weak by modern standards.) If count is 0, a low default cost will be selected. If rbytes is a null pointer, an appropriate number of random bytes will be obtained from the operating system, and nrbytes is ignored. See crypt(5) for other strings that can be used as prefix, and valid values of count for each. RETURN VALUEScrypt_gensalt , crypt_gensalt_rn ,
and crypt_gensalt_ra return a pointer to an encoded
setting string. This string will be entirely printable ASCII, and will not
contain whitespace or the characters
‘: ’,
‘; ’,
‘* ’,
‘! ’, or
‘\ ’. See
crypt(5)
for more detail on the format of this string. Upon error, they return a null
pointer and set errno to an appropriate error code.
Upon error, in addition to returning a null pointer,
ERRORS
FEATURE TEST MACROSThe following macros are defined by<crypt.h> :
PORTABILITY NOTESThe functionscrypt_gensalt ,
crypt_gensalt_rn , and
crypt_gensalt_ra are not part of any standard. They
originate with the Openwall project. A function with the name
crypt_gensalt also exists on Solaris 10 and newer, but
its prototype and semantics differ.
The default prefix and auto entropy features are available since libxcrypt version 4.0.0. Portable software can use feature test macros to find out whether null pointers can be used for the prefix and rbytes arguments. The set of supported hashing methods varies considerably from system to system. ATTRIBUTESFor an explanation of the terms used in this section, see attributes(7).
SEE ALSOcrypt(3), getpass(3), getpwent(3), shadow(3), login(1), passwd(1), crypt(5), passwd(5), shadow(5), pam(8)
Visit the GSP FreeBSD Man Page Interface. |