On Wed, 2002-07-31 at 08:52, Dave Logan wrote:

> If we need to take this "off list" we can do that too, but I'm hoping
> your code snippets will reveal all the secrets, and help someone in the
> future.
> Dave


  Of course - it's early, and I forgot where I was ;-)

===== code follows =====

  function encrypt($password, $salt = '') {
    $MAGIC = '$1$';
    $ITOA64 =
'./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';

    if (strlen($salt) < 8) {
      mt_srand ((double) microtime() * 1000000);

      for ($i = 8; $i > strlen($salt);) {
        $salt .= $ITOA64{mt_rand (0, strlen($ITOA64))};
      }
    }

    $passwd = crypt($password, $MAGIC . $salt);

    return($passwd);
  }

===== code ends =====

  The line above which initialises $ITOA64 has been split by the mua,
and should be a single line, although this should not hurt the
function...


-- 
Cheers,
 Mattt.                           icq   : 117539757
 Network and Tech Guy,            www1  : http://www.pulse.nq4u.net
 Expressnet.                      www2  : http://www.expressnet.net.au
 [EMAIL PROTECTED]          jabber: [EMAIL PROTECTED]


- 
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html

Reply via email to