===== Syntax =====
string crypt(string $str [, string $salt])
//(PHP 4 >= 4.01, PHP 5)//
^ $str | Source text or binary string for generating a crypt string. |
^ $salt | Optional salt string (usually 2 characters long) to use for the encryption string. |
^ RETURNS | Encrypted string of characters used to verify the original data. |
===== What it Does =====
Calculates a hash or a crypt value based on the source text or binary string. This does a one-way encryption meaning that there is no way to undo the encryption (using the crypted result.) This uses the local machines standard Unix DES encryption method. Similar to the [[crc32]] function, this will create a checksum value to verify the integrity of the data.
===== Example =====
// calulate the crypted string from a form post
$chksum = crypt($_POST['body']);
echo sprintf('The crypt result is: %u', $chksum);