One: one-way encryption algorithm
1. MD5 ($STR, BOOL): Returns 32 bits by default, and returns 16-bit binary characters for true;
2, Crypt ($strl, $salt): $salt for interference string, placed in front of the ciphertext, there are many formats;
3. SHA1 ($STR, BOOL): Returns 40 bits by default, returns 20-bit source format characters for true;
Two: Two-way encryption algorithm
1, UrlEncode ();
2, Rawurlencode ();
3, Base64_encode (): transcoding pictures, etc.,
where UrlEncode () and Rawurlencode () are analyzed:
One: The difference is:
UrlEncode () Turns the space to the ' + ' sign, and Rawurlencode () turns the space into%20, which is the only difference.
Two: The same point:
All non-alphanumeric characters except-_ are encoded and converted to% plus two-bit hexadecimal characters.
One-way hash algorithm, symmetric algorithm, asymmetric algorithm:
One-way hashing algorithm: Converts characters of different lengths into strings of the same length;
Symmetric algorithm: Encryption and decoding of the same key, encryption/decryption fast;
Asymmetric algorithm: Encryption uses the public key known to everyone, while decoding can only use the private key you know.
Common cryptographic algorithms for PHP