ADVERTISEMENT
ADVERTISEMENT

PHP program to calculate the md5 hash from plaintext

Here, we are going to learn how to calculate the md5 hash from plaintext in PHP?
Submitted by Nidhi, on November 22, 2020

Here, we will calculate the md5 hash using the md5() function that encrypts the plaintext.

Program/Source Code:

The source code to calculate the md5 hash from plaintext is given below. The given program is compiled and executed successfully.

<?php
//PHP program to calculate the md5 hash from plaintext.
$plaintext = "www.includehelp.com";
printf("Encrypted data: %s<br>", md5($plaintext));
?>

Output:

Encrypted data: 956006613d32bc33569dbb5bd1c32fea

Explanation:

Here, we created a local variable. After that, we called the md5() function that returns the encrypted data and then we printed the returned data using the printf() function on the webpage.

More PHP Programs »


ADVERTISEMENT



ADVERTISEMENT



Comments and Discussions


ADVERTISEMENT

ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT

Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing
» Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates

© https://www.includehelp.com some rights reserved.