- generate encrypted password
#include <crypt.h> char *crypt_genhash_impl(char *ctbuffer, size_t ctbufflen, const char *plaintext, const char *salt, const char **params);
The crypt_genhash_impl() function is called by crypt(3C) to generate the encrypted password plaintext.
The ctbuffer argument is a pointer to an MT-safe buffer of ctbufflen size that is used to return the result.
The salt argument is the salt used in encoding.
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 specifing rounds information "rounds=4096".
The crypt_genhash_impl() function must not free(3C) ctbufflen on error.
Upon successful completion, crypt_genhash_impl() returns a pointer to the encoded version of plaintext. Otherwise a null pointer is returned and errno is set to indicate the error.
The crypt_genhash_impl() function will fail if:
The configuration file crypt.conf contains an invalid entry.
The required shared library was not found.
There is insufficient memory to perform hashing.
See attributes(5) for descriptions of the following attributes: