Searching for "passwords."

Q:

Explain how to create random passwords.

Answer

Generating random passwords in PHP can be done in multiple ways depending on how much security the application demands:-


Md5 function can be passed one parameter as uniqid() function which in turn generates a random number. Passing the parameter as TRUE in uniqid() adds additional uniqueness.


<?php
   $passwd = md5(uniqid(rand(), true));
   Echo $passwd;
?>

Report Error

View answer Workspace Report Error Discuss

Subject: PHP