$data = "Hello, world!"; $hash = hash('sha256', $data); echo $hash; // Output: 98a5184adc2a2492e7c4c3232eaf51c5f93e8d2558c8f805c60feaf3cea24e92
$data = "Secret password"; $hash = hash('sha512', $data); echo $hash; // Output: 13c2e513592f24e9795058583103d3cdee4d7c3fd5735a12c7945a43d3f3ae7051a88f4ffd6d8f1a0974b5e2e6b9c74178c13ad6d1e1f239b384e9e86771f468In this example, we generate a SHA-512 hash of the string "Secret password". This hash is longer than the previous example, but provides increased security due to the increased length and complexity. The PHP Hash library is a core library included with PHP, so there is no need to install any additional package library.