To create a SHA512 hash from a string in PHP, you can use the hash() function with the "sha512" algorithm. Here's an example:
main.php150 chars4 lines
In this example, the $string variable contains the string you want to hash. The $hash variable is set to the result of calling hash('sha512', $string), which generates a SHA512 hash of the input string.
You can use this function to hash sensitive data such as passwords to protect them from hackers. It's also recommended that you use a salt with the hash function to further strengthen the security of the hashed value.
gistlibby LogSnag