![]() |
![]() |
![]() |
Encrypt a password (QNX 4)
#include <unistd.h> char* qnx_crypt( const char* key, const char* salt );
libc
The qnx_crypt() function performs password encryption. It's a variant of the standard crypt() function that uses an encryption similar to, but not compatible with, the Data Encryption Standard (DES) encryption. This function is provided for compatibility with QNX 4.
![]() |
The qnx_crypt() function checks only the first eight characters of key. |
The salt is a two-character string chosen from the set [a-zA-Z0-9./]. Values for salt aren't validated by this function, and values outside this range may cause undefined behaviour.
A pointer to the encrypted value, or NULL on failure.
#include <unistd.h> int main(int argc, char **argv) { char salt[3]; char string[20]; char *result; strcpy(string, "thomasf"); salt[0] = 'a'; salt[1] = 'B'; salt[2] = 0; result = qnx_crypt(string, salt); printf("Result is [%s] --> [%s] \n", string, result); return 0; }
Safety: | |
---|---|
Cancellation point | No |
Interrupt handler | No |
Signal handler | Yes |
Thread | Yes |
The return value points to static data that's overwritten by each call to qnx_crypt().
crypt(), encrypt(), getpass(), setkey()
login in the Utilities reference
![]() |
![]() |
![]() |