Mega Code Archive

 
Categories / Php / Strings
 

Crypt

<?php $password = crypt("My1sTpassword"); # let salt be generated # 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 (crypt($user_input,$password) == $password) { echo "Password verified!"; } ?>