78
PHP string md5() function
PHP string md5() is predefined function. It is used to calculate the MD5 hash of a string. It uses the RSA DATA security. It returns the hash as a 32 character hexadecimal number.
Note: We should not use this function for secure passwords, due to the fast nature of this hashing algorithm.
Syntax:
Parameter | Description | Required/Optional |
---|---|---|
String | Specify string to be calculated. | required |
raw | Specify hex or binary format
| Optional |
Example 1
Output:
Your string is:PHP By using md5() functon:2fec392304a5c23ac138da22847f9b7c
Example 2
Output:
'PHP' string is equall to encrypted string
Example 3
Output:
Your string is: PHP TRUE - Raw 16 character binary format: /ě9# ĄÂ:Á8Ú"??| FALSE - 32 character hex number: 2fec392304a5c23ac138da22847f9b7c
Example 4
Output:
Your string is: PHP By using md5() function: 2fec392304a5c23ac138da22847f9b7c
Note: The encrypted value “8b1a9953c4611296a827abf8c47804d7” is not equal to “PHP” string so Hello PHP message not displayed.
Next TopicPHP String