( zeller | 2008. 01. 25., p – 12:16 )

Kb. 10 perc alatt egy függvény a kódból...

http://www.egroupware.org/viewvc/trunk/setup/account_migration.php?revi…


function hash_sql2ldap($hash)
{
    $type = $GLOBALS['egw_info']['server']['sql_encryption_type'];
    
    if (preg_match('/^\\{(.*)\\}(.*)$/',$hash,$matches))
    {
        $type = $matches[1];
        $hash = $matches[2];
    }
    switch(strtolower($type))
    {
        case '':    // not set sql_encryption_type
        case 'md5':
            $hash = '{md5}' . base64_encode(pack("H*",$hash));
            break;
        case 'crypt':
            $hash = '{crypt}' . $hash;
            break;
            
        case 'plain':
            break;
    }
    return $hash;
}