Tuesday, August 18, 2009

Random password generation in Php

A simple random password generation function which generates various length (up to 32 characters) of password with numerals and alphabets.


Code:

<?php
function genPass($length = 8) //max length = 32 characters
{
return substr(md5(uniqid(rand(), true)), 0, $length);
}
?>

No comments: