43
Encryption
It is a concept of Encoding and Decoding the data. Basically, we have two types of Encryption in PHP. Those are
- One_way Encryption
- Two_way Encryption
One_way Encryption:
By using this, we can encode the data but we cannot decode encoded data.
1. md5() function: (Message-Digest 5)
By using this function, we can encode the data as 32 characters length, alphanumeric string.
Syntax
Parameters
Parameter | Description | Is compulsory |
---|---|---|
String | The string to be calculated. | compulsory |
raw_output | Specifies hex or binary output format: TRUE- Raw 16 character FALSE- Default. | Optional |
Returns
md5() function returns the calculated md5 hash on success, or false on failure.
Example 1
Output:
Example 2
Output:
Next TopicPHP Two-way Encryption