php tutorial - PHP md5 Function - php programming - learn php - php code - php script
- The md5 (message-digest algorithm) is used for calculating the hash of the string value.
- Md5 takes the input message of arbitrary length and produces as output with 128-bit "fingerprint" or "message digest" of the input.
- The MD5 algorithm is intended for digital signature applications, where a large file must be "compressed" in a secure manner before being encrypted with a private (secret) key under a public-key cryptosystem such as RSA (Rivest, Shamir, and Adelman) .
php developer Syntax :
- string Source - defines the input string.
- raw_output – The raw output will work like a Boolean function that is : If TRUE it sets raw 16-character binary format. If FALSE (default) it sets raw 32-character hex number format.
Advantage of Using md5 function :
- Utilizes a fast computation algorithm
- Provides collision resistance
- Widespread Use
- Provides a one-way hash
Disadvantage of Using md5 function :
- Has known security flaws and vulnerabilities
- Is less secure than the SHA-1 algorithm
php 7 Sample Code : sample php program
php program Code Explanation :
- In this echo statement we call the “md5” string function that will be used for calculating the hash function value for the term “wikitechy” .
- In this echo statement we call the “md5” string function that will be used for calculating the hash function value of the term wikitechy and here we use the Boolean function set as true so the raw output of the encrypted text is displayed only the 16 characters in your browser.
php coding Sample Output :
- Output “wikitechy” is encrypted using md5 algorithm which will encrypt by the raw 32-character hex number format.
- Output “wikitechy” is encrypted using md5 algorithm whose argument value set is true which will encrypt by the raw 16-character binary format.