I learned some knowledge about PHP encryption a few days ago, now I will summarize
Several encryption forms in PHP
Md5() encryption algorithm
Crypt() encryption algorithm
Sha1( ) Encryption algorithm
URL encoding encryption technology
Base64 encoding encryption technology
Md5() encryption algorithm
Syntax:
string md5(string $str [, bool $raw_out put = FALSE]) s $ STR: Original string optional (not commonly used)
$ raw_output: If the optional raw_output is set to True, then the MD5 packet abstract will be used in the original binary of 16 byte length. format returned. The default is false, and the hash value is returned in the form of a 32-bit hexadecimal number.
But using only the md5 encryption algorithm can be easily cracked. If there are related md5 decryption websites on the Internet, you can query the relevant md5 ciphertext through the common md5 ciphertext included in its website
It can be enhanced as follows Crack difficulty
md5(md5($str,true))
Crypt() encryption algorithm
Syntax:
string crypt(string $str [, string $salt ]), return A hash string based on the standard UNIX DES algorithm or any alternative algorithm available on the system.
$str: plain text that needs to be confidential
$salt: interference string during encryption, making the encoding more secure
Note:
If the $salt parameter is not added during encryption, it will be random Generate an interference string, otherwise refresh the encrypted ciphertext unchanged
Sha1() encryption algorithm
Syntax:
string sha1(string $str [ , bool $raw_output = false ], calculate the string sha1 hash value
$str: encrypted string
$raw_output: If the optional raw_output parameter is set to TRUE, then the sha1 message digest will be returned in the original format with a length of 20 characters, otherwise it will be returned The value is a 40-character hexadecimal number
Returns the sha1 hash value string
The ciphertext encrypted by sha1 can also be queried on the website. It is not recommended to use sha1 encryption when saving passwords.
sha1(md5(“admin”,true))
URL encoding encryption technology
1.urlencode(string $str): encode URL string
$str: character to be encoded String
Return value: Return the encoded string
Encoding specification: All non-alphanumeric characters in this string except -_. will be replaced with a percent sign (%) followed by two characters Hexadecimal number, spaces are encoded as plus (+) 2.urldecode(string $str): Decode the encoded URL string 3.rawurlencode(string $str): Encode the URL according to RFC1738
$str: URL to be encoded
Return value: Return a string, encode spaces into %20
4.rawurldecode(string $str): Encoded The URL string to be decoded
$str: The URL to be decoded
Return value: Returns a string, the percent sign % followed by the two-digit hexadecimal sequence in this string will be replaced Original characters
$str: The string to be decoded
Return value: Return the decoded string
Base64 encoding encryption technology
1.base64_encode(string $data): Use base64 encodes data
$data: the data to be encoded
2.base64_decode(string $data [.bool $strict = false]): decodes data encoded using MIME base64
$strict : If the input data exceeds the base64 alphabet, return false
The above has introduced PHP encryption technology, including aspects of it. I hope it will be helpful to friends who are interested in PHP tutorials.