wilde: server/kolab-webadmin/kolab-webadmin/php/admin/include passwd.php, NONE, 1.1

cvs at kolab.org cvs at kolab.org
Wed Jan 10 17:00:00 CET 2007


Author: wilde

Update of /kolabrepository/server/kolab-webadmin/kolab-webadmin/php/admin/include
In directory doto:/tmp/cvs-serv5426/kolab-webadmin/kolab-webadmin/php/admin/include

Added Files:
	passwd.php 
Log Message:
Create SSHA (instead of plain SHA1) password hashes.  (fixes kolab/issue1013)


--- NEW FILE: passwd.php ---
<?php
/* -------------------------------------------------------------------
   Copyright (C) 2007 by Intevation GmbH
   Author(s):
   Sascha Wilde <wilde at intevation.de>

   This program is free software under the GNU GPL (>=v2)
   Read the file COPYING coming with the software for details.
   ------------------------------------------------------------------- */

// Generate OpenLDAP style SSHA password strings
function ssha($string, $salt)
{
  return "{SSHA}" . base64_encode(pack("H*", sha1($string . $salt)) . $salt);
}

// return 4 random bytes
function gensalt()
{
  $salt = '';
  while (strlen($salt) < 4)
    $salt = $salt . chr(mt_rand(0,255));
  return $salt;
}

?>




More information about the commits mailing list