Site Tools


# $EPIC: crypt.txt,v 1.2 2007/03/02 02:32:04 jnelson Exp $


$crypt(<string> <salt>)


The <string> and <salt> arguments are dwords which is different from most functions.

Given an arbitrary string and a “salt” (a randomizer), this function returns the input string in a one-way encrypted form. This function depends on the availability of a local crypt(3) library function. Only the first 8 characters of the input string are significant. The salt is a two-character string, and may be composed of any combination of any alphanumeric character, a period (.), or a forward-slash (/). Additional characters may be available, depending on the crypt(3) in use at your site.


This function is primarily used for encrypting passwords, Unix style. It is helpful if the input salt is itself sufficiently random. Case is preserved in both the salt and input string.


encrypted input text, or nothing if error


$crypt(foobar ab)              returns "foobar" encrypted with salt "ab"

Other Notes:

As mentioned above, this function relies completely on the availability of a local crypt(3) library function. This function is not available on some systems. Refer to your system's manual pages for more information.

crypt.txt · Last modified: 2007/03/02 02:32 (external edit)