Jump to content

Recommended Posts

yes you can...
[code]$username = "user"; //current usrename ;
$part1 = split($username,3); // Splitting first three chars for the username... Out put is an array ;
$random_number = rand(2,78); // getting one random no between 2 to 78 ;
$string = $part1[0] . $random_number; //making one new string...
$newmd = md5($string); // MD5 encry of new string.
$newpass = split($newmd,12); // spliting result with 12 chars
$password = $newpass[0]; // use this $password to mail your user...[/code]

Let me know how it is....

Thank you,
Karthi keyan

Link to comment
https://forums.phpfreaks.com/topic/13750-random-pass-gen/#findComment-53424
Share on other sites

this is what I do:

[code]<?php
  //using pre-specified letters and numbers arrays to eliminate eL's and one's and Oh's and zero's
      $letters = array('a','b','c','d','e','f','g','h','j','k','m','n','p','q','r','s','t','u','v','x','y','z');
      $numbers = array('2','3','4','5','6','7','8','9');

        for ($i=0; $i<5; $i++) // Pick 5 random letters
        {
        $passwordArray[$i] = $letters[rand(0,count($letters))];
//$passwordArray[$i] = chr(rand(97,122));
        }
      for ($i=5; $i<8; $i++) // Pick 3 random numbers
{
        $passwordArray[$i] = $numbers[rand(0,count($numbers))];
//$passwordArray[$i] = chr(rand(48,57));
        }
      shuffle($passwordArray); //(put the 8 charecters in random order)
      $sendPassword = implode("",$passwordArray);
        // end create password

echo $sendPassword; // you can md5 this or e-mail it or encrypt it or whatever

?>[/code]
Link to comment
https://forums.phpfreaks.com/topic/13750-random-pass-gen/#findComment-53426
Share on other sites

i wouldn't say md5() is as secure anymore. hash collision can occur depending on the prefixes you use.

why not try sha1() instead?

maybe you could do something like this...off the top of my head:
[code=php:0]
<?php
    //assume $oldPass is the md5() value of his old password in your database
    $string = date('U') . $username . $oldPass;
    echo 'New password is: ' . sha1($string, true);
?>
[/code]


You might want to use the algorithms the others have posted in this thread becuse mine is relatively simple but i would avoid md5()...but it's generally ok to use MD5 unless you know some REALLY nasty people who would REALLY want to get back at you for something :)
Link to comment
https://forums.phpfreaks.com/topic/13750-random-pass-gen/#findComment-53433
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.