To create a SHA256 hash from a string in PHP, you can use the hash
function with the algorithm sha256
. Here's an example code snippet:
main.php70 chars4 lines
This will output the SHA256 hash of the string "hello world". You can replace "hello world" with any string that you want to generate a hash for.
It's worth noting that SHA256 is a one-way hashing algorithm, meaning that it's not possible to reverse-engineer the original string from the hash. This makes it a popular choice for securing sensitive data, such as passwords.
gistlibby LogSnag