What is the difference between encryption and hashing in the context of PHP, specifically with MD5?
Encryption is the process of converting data into a secret code to prevent unauthorized access, while hashing is the process of converting data into a fixed-length string of characters that is unique to that specific input. In the context of PHP, specifically with MD5, MD5 is a hashing algorithm, not an encryption algorithm. This means that MD5 should be used for hashing data to verify its integrity, not for encrypting sensitive information.
// Using MD5 for hashing data
$data = "Hello World";
$hashed_data = md5($data);
echo $hashed_data;