Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

crypt - encode strings using algorithms

&pagelevel(4)&pagelevel

Syntax

#include <unistd.h>

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

Description crypt() is a string encoding function. It is based on a one-way encoding algorithm with

variations intended to prevent the use of hardware implementations for a key search.

key is the input string to be encoded, typically a user's password. salt is a two-character
string chosen from the set of characters (a-z, A-Z, 0-9, . , /).
This string is used to vary the encoding algorithm in one of 4096 different ways, after which
the input string is used as the key to repeatedly encode a constant string. The returned
value points to the encoded input string.

Return val.

Pointer to the encoded string.

The first two characters of the returned value are those of the salt argument.

Null pointer

if an error occurs;
errno is set to indicate the error.

Notes

See also

The return value of crypt() points to static data that is overwritten at each call.

encrypt(), setkey(), unistd.h.