- crypt: documentation ( source)
- hash_equals: documentation ( source)
<?php
$hashed_password = crypt('superadmin', '$r!lanka'); // let the salt be automatically generated
echo $hashed_password;exit;
if (hash_equals($hashed_password, crypt($user_input, $hashed_password))) {
echo "Password verified!";
}