crypt()

Закодировать пароль

Прототип:

#include <unistd.h>
char * crypt( const char *key,
const char *salt );

Аргументы:

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.

Библиотека:

libc

Описание:

The crypt() function performs password encryption. It's based on the Data Encryption Standard algorithm, and also includes code to deter key search attempts.


Note: This function checks only the first eight characters of key.

You can obtain a 56-bit key by taking the lowest 7 bits of key. The 56-bit key is used to repeatedly encrypt a constant string (usually all zeroes).

Возвращаемое значение:

A pointer to the 13-character encrypted value, or NULL on failure. The first two characters of the encrypted value are the salt itself.

Классификация:

POSIX 1003.1 XSI

Точка остановки потока
Нет
Обработчик прерываний
Нет
Обработчик сигналов
Нет
В потоке
Нет

Предостережения:

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

Тематические ссылки:

encrypt(), getpass(), setkey()

login в Справочнике по Утилитам




Предыдущий раздел: Описание API системной библиотеки