PHP encryption algorithm is used to encrypt the PHP code, then what is the PHP encryption algorithm? In this article I will share several PHP encryption algorithms, and then we will take a look at what the article says.
1.MD5 () encryption algorithm-one-way encryption, cannot decrypt
Syntax: String MD5 (String $str, $raw=false),
$STR: Required. Specifies the string to be computed,
$raw: Optional. Specify hexadecimal or binary output formats:
return value : Returns the computed MD5 hash if successful, or false if it fails
2.Crypt () encryption algorithm-also one-way encryption
Syntax: String crypt (String $str, String, $salt),
$STR: Required. Specifies the string to be computed,
$salt, Optional. Used to increase the number of characters encoded in a string to make the encoding more secure. If you do not provide a salt parameter, PHP randomly generates one each time the function is called.
return value : Returns a hash string based on the standard Unix des algorithm or other available substitution algorithms on the system
Example: 1.crypt (' Zhangsan ');--output $1$ax3.sx0. $PcFaGWCv 51uno.1eivmpy0 (the $1$ax3.sx0.$ at the front is the random string)
2.crypt (' Zhangsan ', ' we ');--Output wegsa6nise59k ("we" is constant)
Supported algorithms for a variety of PHP settings:
3.SHA1 () encryption algorithm (one-way encryption)
Syntax: String SHA1 (String $str, $raw_output=false),
$STR: Encrypted string
$raw _output: If the optional raw_output parameter is set to True, the SHA1 digest is returned in the original format of 20-character length, otherwise the return value is a 40-character hexadecimal number.
Return value: SHA1 hash value string
Note: The same as MD5 Baidu on the upper part of the decryption site can refer to his early recorded ciphertext and we entered the ciphertext to compare, so that the clear, but not the real meaning of the crack, multiple encryption can prevent the occurrence of this thing.
4.URL coded encryption algorithm-bidirectional
One, UrlEncode (string $str): Encode URL string, $str: string return value to encode: Returns the encoded string
Code specification: All non-alphanumeric characters outside of this string are replaced with a percent sign (%) followed by a two-digit hexadecimal number, and a space is encoded as a plus (+)-_.
The commonly used characters are encoded after the encoded format is represented in parentheses:? (%3f), = (%3d), space (+),% (%25),& (%26), \ (%5c), + (%2B)
Second, UrlDecode (string $str): Decodes the encoded URL string, $str: The string to decode returns the value: Returns the decoded string
Note: The Rawurlencode encoding Rawurldecode decoding is exactly the same as the UrlEncode UrlDecode above, the only difference: Rawurlencode encode spaces into%20
5.BASE64 coded encryption technology--bidirectional
Base64_encode (String $data): Encode data using base64
Second, Base64_decode (string $data, $strict =false): Decodes data encoded using Base64, $STRICT returns False if the input data exceeds the Base64 alphabet
Summary: The approximate encryption technology can be divided into the following three kinds of
1. One-way Hash encryption
2. Symmetric hashing encryption
3. Asymmetric Hash Encryption