module/Core/src/Grid/Core/Installer/Patch.php
private function createPasswordSalt( $length = 22 )
    {
        static $chars = './0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';

        if ( function_exists( 'openssl_random_pseudo_bytes' ) &&
             ( version_compare( PHP_VERSION, '5.3.4' ) >= 0 ||
               strtoupper( substr( PHP_OS, 0, 3 ) ) !== 'WIN' ) )
        {
            $bytes = openssl_random_pseudo_bytes( $length, $usable );

            if ( true !== $usable )
            {
                $bytes = null;
            }
        }

        if ( empty( $bytes ) &&
             function_exists( 'mcrypt_create_iv' ) &&
             ( version_compare( PHP_VERSION, '5.3.7' ) >= 0 ||
               strtoupper( substr( PHP_OS, 0, 3 ) ) !== 'WIN' ) )
        {
            $bytes = mcrypt_create_iv( $length, MCRYPT_DEV_URANDOM );

            if ( empty( $bytes ) || strlen( $bytes ) < $length )
            {
                $bytes = null;
            }
        }

        if ( empty( $bytes ) )
        {
            $bytes = '';

            for ( $i = 0; $i < $length; ++$i )
            {
                $bytes .= chr( mt_rand( 0, 255 ) );
            }
        }

        $pos  = 0;
        $salt = '';
        $clen = strlen( $chars );

        for ( $i = 0; $i < $length; ++$i )
        {
            $pos = ( $pos + ord( $bytes[$i] ) ) % $clen;
            $salt .= $chars[$pos];
        }

        return $salt;
    }
private function createPasswordSalt( $length = 22 )
    {
        static $chars = './0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';

        if ( function_exists( 'openssl_random_pseudo_bytes' ) &&
             ( version_compare( PHP_VERSION, '5.3.4' ) >= 0 ||
               strtoupper( substr( PHP_OS, 0, 3 ) ) !== 'WIN' ) )
        {
            $bytes = openssl_random_pseudo_bytes( $length, $usable );

            if ( true !== $usable )
            {
                $bytes = null;
            }
        }

        if ( empty( $bytes ) &&
             function_exists( 'mcrypt_create_iv' ) &&
             ( version_compare( PHP_VERSION, '5.3.7' ) >= 0 ||
               strtoupper( substr( PHP_OS, 0, 3 ) ) !== 'WIN' ) )
        {
            $bytes = mcrypt_create_iv( $length, MCRYPT_DEV_URANDOM );

            if ( empty( $bytes ) || strlen( $bytes ) < $length )
            {
                $bytes = null;
            }
        }

        if ( empty( $bytes ) )
        {
            $bytes = '';

            for ( $i = 0; $i < $length; ++$i )
            {
                $bytes .= chr( mt_rand( 0, 255 ) );
            }
        }

        $pos  = 0;
        $salt = '';
        $clen = strlen( $chars );

        for ( $i = 0; $i < $length; ++$i )
        {
            $pos = ( $pos + ord( $bytes[$i] ) ) % $clen;
            $salt .= $chars[$pos];
        }

        return $salt;
    }
private function createPasswordSalt ( $ length = 22 ) { static $ chars = './0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz' ; if ( function_exists ( 'openssl_random_pseudo_bytes' ) && ( version_compare ( PHP_VERSION , '5.3.4' ) >= 0 || strtoupper ( substr ( PHP_OS , 0 , 3 ) ) !== 'WIN' ) ) { $ bytes = openssl_random_pseudo_bytes ( $ length , $ usable ) ; if ( true !== $ usable ) { $ bytes = null ; } } if ( empty ( $ bytes ) && function_exists ( 'mcrypt_create_iv' ) && ( version_compare ( PHP_VERSION , '5.3.7' ) >= 0 || strtoupper ( substr ( PHP_OS , 0 , 3 ) ) !== 'WIN' ) ) { $ bytes = mcrypt_create_iv ( $ length , MCRYPT_DEV_URANDOM ) ; if ( empty ( $ bytes ) || strlen ( $ bytes ) < $ length ) { $ bytes = null ; } } if ( empty ( $ bytes ) ) { $ bytes = '' ; for ( $ i = 0 ; $ i < $ length ; ++ $ i ) { $ bytes .= chr ( mt_rand ( 0 , 255 ) ) ; } } $ pos = 0 ; $ salt = '' ; $ clen = strlen ( $ chars ) ; for ( $ i = 0 ; $ i < $ length ; ++ $ i ) { $ pos = ( $ pos + ord ( $ bytes [ $ i ] ) ) % $ clen ; $ salt .= $ chars [ $ pos ] ; } return $ salt ; }
Create password-salt

@param   int     $length
@return  string
Create password - salt