HTML Utilities

Showing help on 'crypt()'

Syntax: crypt (str <text> [, str <salt>]) => str

Encrypts the given <text> using the standard UNIX encryption method. If
provided, <salt> should be a two-character string for use as the extra
encryption ``salt'' in the algorithm. If <salt> is not provided, a random
pair of characters is used. In any case, the salt used is also returned as the
first two characters of the resulting encrypted string.

Aside from the possibly-random selection of the salt, the encryption algorithm
is entirely deterministic. In particular, you can test whether or not a given
string is the same as the one used to produced a given piece of encrypted text;
simply extract the first two characters of the encrypted text and pass the
candidate string and those two characters to `crypt()'. If the result is
identical to the given encrypted text, then you've got a match.

crypt("foobar") => "J3fSFQfgkp26w"
crypt("foobar", "J3") => "J3fSFQfgkp26w"
crypt("mumble", "J3") => "J3D0.dh.jjmWQ"
crypt("foobar", "J4") => "J4AcPxOJ4ncq2"



-- telnet://project-mongoose.net:7777 -- Mail us -- http://project-mongoose.net:7780/ --
-- Five users connected --