- generate salt for password encryption
#include <crypt.h> char *crypt_gensalt_impl(char *gsbuffer, size_t gsbufflen, const char *oldsalt, const struct passwd *userinfo, const char **params);
The crypt_gensalt_impl() function is called by crypt_gensalt(3C) to generate the salt for password encryption.
The gsbuffer argument is a pointer to an MT-safe buffer of size gsbufflen.
The oldsalt and userinfo arguments are passed unchanged from crypt_gensalt(3C).
The params argument is an argv-like null terminated vector of type char *. The first element of params represents the mechanism token name from crypt.conf(4). The remaining elements of params represent strings of the form <parameter>[=<value>] to allow passing in additional information from the crypt.conf entry, such as specifying rounds information "rounds=4096".
Upon successful completion, crypt_gensalt_impl() returns a pointer to the new salt. Otherwise a null pointer is returned and errno is set to indicate the error.
The crypt_gensalt_impl() function will fail if:
The configuration file crypt.conf contains an invalid entry.
The required crypt shared library was not found.
There is insufficient memory to perform hashing.
See attributes(5) for descriptions of the following attributes: