To create a MD5 hash from a string in PHP, you can use the md5()
function. Here's an example:
main.php145 chars4 lines
In the example above, we first define the string to be hashed as $string
. Then, we pass $string
to the md5()
function, which returns the hash as a string. Finally, we output the hash using the echo
statement.
Note that MD5 is a relatively weak hashing algorithm and should not be used for sensitive information such as passwords.
gistlibby LogSnag