CRYPT_GENSALT - Online Linux Manual PageSection : 3
Updated : October 11, 2017
Operating system : Openwall Project
NAME crypt_gensalt, crypt_gensalt_rn, crypt_gensalt_ra —encode settings for passphrase hashing
LIBRARYCrypt Library (libcrypt , -lcrypt)
SYNOPSIS #include <crypt.h>
char * crypt_gensalt ( const char *prefix , unsigned long count , const char *rbytes , int nrbytes );
char * crypt_gensalt_rn ( const char * prefix , unsigned long count , const char *rbytes , int nrbytes , char * output , int output_size );
char * crypt_gensalt_ra ( const char *prefix , unsigned long count , const char *rbytes , int nrbytes );
DESCRIPTIONThe crypt_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 VALUES crypt_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. crypt_gensalt places its result in a static storage area, which will be overwritten by subsequent calls to crypt_gensalt. It is not safe to call crypt_gensalt from multiple threads simultaneously. However, it is safe to pass the string returned by crypt_gensalt directly to crypt without copying it; each function has its own static storage area. crypt_gensalt_rn places its result in the supplied output buffer, which has output_size bytes of storage available. output_size should be greater than or equal to CRYPT_GENSALT_OUTPUT_SIZE. crypt_gensalt_ra allocates memory for its result using malloc(3). It should be freed with free(3) after use. Upon error, in addition to returning a null pointer, crypt_gensalt and crypt_gensalt_rn will write an invalid setting string to their output buffer, if there is enough space; this string will begin with a ‛ * ’ and will not be equal to prefix.
ERRORS EINVAL prefix is invalid or not supported by this implementation; count is invalid for the requested prefix; the input nrbytes is insufficient for the smallest valid salt with the requested prefix. ERANGE crypt_gensalt_rn only: output_size is too small to hold the compiled setting string. ENOMEM Failed to allocate internal scratch memory.
crypt_gensalt_ra only: failed to allocate memory for the compiled setting string. ENOSYS, EACCES, EIO, etc. Obtaining random bytes from the operating system failed. This can only happen when rbytes is a null pointer.
FEATURE TEST MACROSThe following macros are defined by <crypt.h>: Dv CRYPT_GENSALT_IMPLEMENTS_DEFAULT_PREFIX A null pointer can be specified as the prefix argument. Dv CRYPT_GENSALT_IMPLEMENTS_AUTO_ENTROPY A null pointer can be specified as the rbytes argument.
PORTABILITY NOTESThe functions crypt_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). InterfaceAttributeValue crypt_gensalt Thread safetyMT-Unsafe race:crypt_gensalt crypt_gensalt_rn, crypt_gensalt_ra Thread safetyMT-Safe
SEE ALSOcrypt(3), getpass(3), getpwent(3), shadow(3), login(1), passwd(1), crypt(5), passwd(5), shadow(5), pam(8) 0
Johanes Gumabo
Data Size : 16,833 byte
man-crypt_gensalt_rn.3Build : 2024-12-05, 20:55 :
Visitor Screen : x
Visitor Counter ( page / site ) : 2 / 186,746
Visitor ID : :
Visitor IP : 18.224.43.98 :
Visitor Provider : AMAZON-02 :
Provider Position ( lat x lon ) : 39.962500 x -83.006100 : x
Provider Accuracy Radius ( km ) : 1000 :
Provider City : Columbus :
Provider Province : Ohio , : ,
Provider Country : United States :
Provider Continent : North America :
Visitor Recorder : Version :
Visitor Recorder : Library :
Online Linux Manual Page : Version : Online Linux Manual Page - Fedora.40 - march=x86-64 - mtune=generic - 24.12.05
Online Linux Manual Page : Library : lib_c - 24.10.03 - march=x86-64 - mtune=generic - Fedora.40
Online Linux Manual Page : Library : lib_m - 24.10.03 - march=x86-64 - mtune=generic - Fedora.40
Data Base : Version : Online Linux Manual Page Database - 24.04.13 - march=x86-64 - mtune=generic - fedora-38
Data Base : Library : lib_c - 23.02.07 - march=x86-64 - mtune=generic - fedora.36
Very long time ago, I have the best tutor, Wenzel Svojanovsky . If someone knows the email address of Wenzel Svojanovsky , please send an email to johanes_gumabo@yahoo.co.id .
If error, please print screen and send to johanes_gumabo@yahoo.co.id
Under development. Support me via PayPal.
ERROR : Need New Coding : (mdoc_err|80|crypt_gensalt.3|209|Dv|.It Dv CRYPT_GENSALT_IMPLEMENTS_DEFAULT_PREFIX
) (mdoc_err|80|crypt_gensalt.3|213|Dv|.It Dv CRYPT_GENSALT_IMPLEMENTS_AUTO_ENTROPY
)