Krypta (Php 4, Php 5, Php 7, Php 8) Krypta Einweg-String-Hashing
<?php
// let the salt be automatically generated; not recommended
$hashed_password = crypt('mypassword');
/* You should pass the entire results of crypt() as the salt for comparing a
password, to avoid problems when different hashing algorithms are used. (As
it says above, standard DES-based password hashing uses a 2-character salt,
but MD5-based hashing uses 12.) */
if (hash_equals($hashed_password, crypt($user_input, $hashed_password))) {
echo "Password verified!";
}
?>
SAMER SAEID