src/thinkextend/Crypt.php
protected static function createIV($size)
    {
        if (function_exists('openssl_random_pseudo_bytes')) {
            $bytes = openssl_random_pseudo_bytes($size, $strong);
        }
        if (is_null($bytes) || $bytes === false || $strong === false) {
            $size *= 2;
            $pool  = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ';
            $bytes = pack('H*', substr(str_shuffle(str_repeat($pool, $size)), 0, $size));
        }
        return $bytes;
    }
protected static function createIV($size)
    {
        if (function_exists('openssl_random_pseudo_bytes')) {
            $bytes = openssl_random_pseudo_bytes($size, $strong);
        }
        if (is_null($bytes) || $bytes === false || $strong === false) {
            $size *= 2;
            $pool  = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ';
            $bytes = pack('H*', substr(str_shuffle(str_repeat($pool, $size)), 0, $size));
        }
        return $bytes;
    }
protected static function createIV ( $ size ) { if ( function_exists ( 'openssl_random_pseudo_bytes' ) ) { $ bytes = openssl_random_pseudo_bytes ( $ size , $ strong ) ; } if ( is_null ( $ bytes ) || $ bytes === false || $ strong === false ) { $ size *= 2 ; $ pool = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ' ; $ bytes = pack ( 'H*' , substr ( str_shuffle ( str_repeat ( $ pool , $ size ) ) , 0 , $ size ) ) ; } return $ bytes ; }
随机生成指定长度的初始化向量

@param  int $size 初始化向量长度

@return string
随机生成指定长度的初始化向量