Warning: main(/www/www/htdocs/style/globals.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/q/qnx_crypt.html on line 1

Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/globals.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/q/qnx_crypt.html on line 1

Warning: main(/www/www/htdocs/style/header.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/q/qnx_crypt.html on line 8

Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/header.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/q/qnx_crypt.html on line 8

qnx_crypt()

Encrypt a password (QNX 4)

Synopsis:

#include <unistd.h>

char* qnx_crypt( const char* key, 
                 const char* salt );

Arguments:

key
A NUL-terminated string (normally a password typed by a user).
salt
A two-character string chosen from the set [a-zA-Z0-9./]. This function doesn't validate the values for salt, and values outside this range may cause undefined behavior. This string is used to perturb the algorithm in one of 4096 different ways.

Library:

libc

Use the -l c option to qcc to link against this library. This library is usually included automatically.


Note: This function is in libc.a, but not in libc.so (in order to save space).

Description:

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.


Note: The qnx_crypt() function checks only the first eight characters of key.

Returns:

A pointer to the encrypted value, or NULL on failure.

Examples:

#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;
}

Classification:

QNX Neutrino

Safety:
Cancellation point No
Interrupt handler No
Signal handler Yes
Thread Yes

Caveats:

The return value points to static data that's overwritten by each call to qnx_crypt().

See also:

crypt(), encrypt(), getpass(), setkey()

login in the Utilities Reference


Warning: main(/www/www/htdocs/style/footer.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/q/qnx_crypt.html on line 181

Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/footer.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/q/qnx_crypt.html on line 181