crypt()
QNX SDP8.0C Library ReferenceAPIDeveloper
Hash a password
Synopsis:
#include <unistd.h>
char * crypt( const char * key,
const char * salt );
Arguments:
- key
- A NUL-terminated string (normally a password typed by a user).
- salt
- A string that uses the format
@
digest@X@
salt or@
digest,
iterations@X@
salt, which specifies the standard PBKDF2 implementation and where:- digest is either
S
(use SHA512 digest) ors
(use SHA256 digest). - iterations is an optional value that follows the digest character and a comma that specifies an iterations value to use instead of the default value used in PBKDF2 (4096).
- salt is the Base64-encoded salt value.
@S,8192@X@salt
- digest is either
Library:
liblogin
Use the -l login option to qcc to link against this library.
Description:
The crypt() function hashes a password.
For license information, see
Licensing information
in Typographical Conventions, Support, and Licensing.
Returns:
A salted hash of desired length, or NULL on failure. This can be either a hexidecimal or base-64 string.
Note:
The return value points to static data that's overwritten by each call to crypt().
Errors:
- ENOMEM
- There isn't enough memory.
- EINVAL
- Indicates the string referenced by the salt variable has an invalid format.
- ENOSYS
- One or more of the following is true:
- One or both of the key or salt variables are NULL.
- The string reference by the salt variable is in the format expected for the legacy DES-based password hashing scheme, which is no longer supported.
Classification:
Safety: | |
---|---|
Cancellation point | No |
Signal handler | No |
Thread | No |
Page updated: