The crypt () function can complete one-way encryption functions.
String crypt (String str [, string salt]);
STR: is a string that needs to be encrypted; salt: The interference string used for encryption. If the salt is omitted, a disturbance string is randomly generated.
The crypt () function supports 4 algorithms and lengths:
________________________________________________
Algorithms | Salt length
Crypt_std_des | 2-character (default)
Crypt_ext_des | 9-character
CRYPT_MD5 | 12-character (starting with $1$)
Crypt_blowfish | 16-character (starting with $2$)
———————————————————————————
Crypt () function is one-way encryption, ciphertext can not be reduced to plaintext, the data after each encryption is not the same, how to judge it?
-This is the problem that the salt parameter solves. The crypt () function uses the salt parameter to encrypt the plaintext, and when it is judged, the output information is encrypted again using the same salt parameter, which is compared with the result of two times encryption.