Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Calculates the MD5 hash of str using the RSA Data Security, Inc. MD5 Message-
Digest Algorithm, and returns that hash. The hash is a 32-character hexadecimal
number.
$msg = "Evergreenphp123";
$encrypted_text = md5($msg);
echo "
Plain Text : ";
echo $msg;
echo "
Encrypted Text : ";
echo $encrypted_text;
?>
Note :
Once we encrypted the string using MD5() then we can't able to decrypt, we can
again use the encrption of
the given string instead of decryption using below example.
Example :
$str = 'apple';
Applications of MD5:
Encryption
This encoding is designed to make binary data survive transport through transport
layers that are not 8-bit clean, such as mail bodies.
Example :
/* Encrypt */
$str = 'This is an encoded string';
echo base64_encode($str);
/*
Output :
VGhpcyBpcyBhbiBlbmNvZGVkIHN0cmluZw==
*/
?>
Decryption
decodes encoded_data and returns the original data or FALSE on failure. The
returned data may be binary.
Example :
/* Decrypt */
$str = 'VGhpcyBpcyBhbiBlbmNvZGVkIHN0cmluZw==';
echo base64_decode($str);
/*
Output :
This is an encoded string
*/
?>