当前位置: 首页>>代码示例>>PHP>>正文


PHP mcrypt_list_algorithms函数代码示例

本文整理汇总了PHP中mcrypt_list_algorithms函数的典型用法代码示例。如果您正苦于以下问题:PHP mcrypt_list_algorithms函数的具体用法?PHP mcrypt_list_algorithms怎么用?PHP mcrypt_list_algorithms使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了mcrypt_list_algorithms函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: _key

function _key($v, $arg)
{
    echo '  key: ' . $v;
    if (count($arg) > 0) {
        echo "\n\n  Arguments:";
        foreach ($arg as $a) {
            echo "\n\t{$a}";
        }
    }
    if ($v == 'generate') {
        if (!is_dir(CONFIG_KEYS_PATH)) {
            mkdir(CONFIG_KEYS_PATH, 0777);
        }
        $base = ['I', 'u', 'h', '5', 'B', 'A', 'r', 'i', '7', '9', 'z', 'd', 'n', 't', 'F', '2', 'W', 'X', 'f', 'e', 'x', 'v', '_', '8', 'm', 'T', 'N', 'R', 'L', 'c', '6', 'P', 'k', 'Q', 'q', 'j', 'Y', 'M', '4', 'S', 'G', 'o', '0', '$', 'K', 's', 'g', 'H', 'E', 'b', 'a', 'J', 'U', 'Z', 'l', '1', 'O', '3', 'y', 'p', 'V', 'D', 'C', 'w'];
        $extra = ['$', '!', '#', '%', '&', '*', '+', '-', '?', '@', '(', ')', '/', '\\', '[', ']', '_', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'];
        shuffle($base);
        shuffle($extra);
        file_put_contents(CONFIG_KEYS_PATH . 'can.key', implode($base) . "\n" . implode($extra));
        echo "\n\n  New CAN key generated - success!";
        //Now, OPEN_SSL
        include CLI_PATH . 'open.php';
        return "\n\n  OpenSSL keys & certificates - success!";
    } elseif ($v == 'list') {
        echo "\n\n  Ciphers:";
        foreach (mcrypt_list_algorithms() as $x) {
            echo "\n\t" . $x;
        }
        echo "\n\n  Cipher Modes:";
        foreach (mcrypt_list_modes() as $x) {
            echo "\n\t" . $x;
        }
    } else {
        return "\n\n  ----- ERROR: Command 'key:{$v}' not found!\n" . _help();
    }
}
开发者ID:3razil,项目名称:frame,代码行数:35,代码来源:limp.php

示例2: get_system_requirements

 public static function get_system_requirements()
 {
     return [['name' => 'Memory limit', 'expected_value' => '640M', 'current_value' => function () {
         return ini_get('memory_limit');
     }, 'check' => function ($current_value, $expected_value) {
         return intval($current_value) >= intval($expected_value);
     }], ['name' => 'Max execution time', 'expected_value' => '30', 'current_value' => function () {
         return ini_get('max_execution_time');
     }, 'check' => function ($current_value, $expected_value) {
         return intval($current_value) >= intval($expected_value);
     }], ['name' => 'cUrl enabled', 'expected_value' => 'Yes', 'current_value' => function () {
         return extension_loaded('curl') ? 'Yes' : 'No';
     }, 'check' => function ($current_value, $expected_value) {
         return $current_value == 'Yes';
     }], ['name' => 'mCrypt enabled', 'expected_value' => 'Yes', 'current_value' => function () {
         return extension_loaded('mcrypt') ? 'Yes' : 'No';
     }, 'check' => function ($current_value, $expected_value) {
         return $current_value == 'Yes';
     }], ['name' => 'RIJNDAEL 128 available', 'expected_value' => 'Yes', 'current_value' => function () {
         return extension_loaded('mcrypt') && in_array('rijndael-128', mcrypt_list_algorithms()) ? 'Yes' : 'No';
     }, 'check' => function ($current_value, $expected_value) {
         return $current_value == 'Yes';
     }], ['name' => 'CBC mode available', 'expected_value' => 'Yes', 'current_value' => function () {
         return extension_loaded('mcrypt') && in_array('cbc', mcrypt_list_modes()) ? 'Yes' : 'No';
     }, 'check' => function ($current_value, $expected_value) {
         return $current_value == 'Yes';
     }], ['name' => 'SHA512 available', 'expected_value' => 'Yes', 'current_value' => function () {
         return in_array('sha512', hash_algos()) ? 'Yes' : 'No';
     }, 'check' => function ($current_value, $expected_value) {
         return $current_value == 'Yes';
     }]];
 }
开发者ID:ArloSoftware,项目名称:arlowp-plugin,代码行数:32,代码来源:arlo-system-requirements.php

示例3: encryptalgo

function encryptalgo($config)
{
    if (@function_exists('mcrypt_list_algorithms')) {
        $listed = array();
        if (!isset($config['mcrypt_algo'])) {
            $config['mcrypt_algo'] = 'tripledes';
            /* MCRYPT_TRIPLEDES */
        }
        $algos = @mcrypt_list_algorithms();
        $found = False;
        while (list($key, $value) = each($algos)) {
            $found = True;
            /* Only show each once - seems this is a problem in some installs */
            if (!in_array($value, $listed)) {
                if ($config['mcrypt_algo'] == $value) {
                    $selected = ' selected';
                } else {
                    $selected = '';
                }
                $descr = strtoupper($value);
                $out .= '<option value="' . $value . '"' . $selected . '>' . $descr . '</option>' . "\n";
                $listed[] = $value;
            }
        }
        if (!$found) {
            /* Something is wrong with their mcrypt install or php.ini */
            $out = '<option value="">' . lang('no algorithms available') . '</option>' . "\n";
        }
    } else {
        $out = '<option value="tripledes">TRIPLEDES</option>' . "\n";
    }
    return $out;
}
开发者ID:BackupTheBerlios,项目名称:milaninegw-svn,代码行数:33,代码来源:hook_config.inc.php

示例4: setAlgo

 public function setAlgo($algo)
 {
     $algorithms = mcrypt_list_algorithms("/usr/local/lib/libmcrypt");
     if (in_array($algo, $algorithms)) {
         $this->algo = $algo;
     }
 }
开发者ID:uhtoff,项目名称:eCRF,代码行数:7,代码来源:Encrypt.php

示例5: Download

 public function Download($link)
 {
     if (!extension_loaded('mcrypt') || !in_array('rijndael-128', mcrypt_list_algorithms(), true)) {
         html_error("Mcrypt module isn't installed or it doesn't have support for the needed encryption.");
     }
     $this->RLCheck();
     $this->seqno = mt_rand();
     $this->changeMesg(lang(300) . '<br />Mega.co.nz plugin by Th3-822');
     // Please, do not remove or change this line contents. - Th3-822
     $fragment = parse_url($link, PHP_URL_FRAGMENT);
     if (preg_match('@^F!([^!]{8})!([\\w\\-\\,]{22})@i', $fragment, $fid)) {
         return $this->Folder($fid[1], $fid[2]);
     }
     if (!preg_match('@^(T8)?!([^!]{8})!([\\w\\-\\,]{43})@i', $fragment, $fid)) {
         html_error('FileID or Key not found at link.');
     }
     $reply = $this->apiReq(array('a' => 'g', 'g' => '1', empty($fid[1]) ? 'p' : 'n' => $fid[2], 'ssl' => '0'));
     $this->CheckErr($reply[0]);
     if (!empty($reply[0]['e'])) {
         $this->CheckErr($reply[0]['e']);
     }
     $key = $this->base64_to_a32($fid[3]);
     $iv = array_merge(array_slice($key, 4, 2), array(0, 0));
     $key = array($key[0] ^ $key[4], $key[1] ^ $key[5], $key[2] ^ $key[6], $key[3] ^ $key[7]);
     $attr = $this->dec_attr($this->base64url_decode($reply[0]['at']), $key);
     if (empty($attr)) {
         html_error((!empty($fid[1]) ? 'Folder Error: ' : '') . 'File\'s key isn\'t correct.');
     }
     $this->RedirectDownload($reply[0]['g'], $attr['n'], 0, 0, $link, 0, 0, array('T8[fkey]' => $fid[3]));
 }
开发者ID:sayedharounokpay,项目名称:LikesPlanet,代码行数:30,代码来源:mega_co_nz.php

示例6: IsMcryptAvailable

 static function IsMcryptAvailable()
 {
     if (!is_bool(self::$mcryptavailable)) {
         self::$mcryptavailable = function_exists("mcrypt_module_open") && in_array("rijndael-128", mcrypt_list_algorithms());
     }
     return self::$mcryptavailable;
 }
开发者ID:marks2016,项目名称:sso,代码行数:7,代码来源:sso_aes.php

示例7: encryptalgo

/**
 * Get selectbox for supported encryption algorithms selectbox
 *
 * @param $config
 * @return string HTML code for encryption algorithm selection
 */
function encryptalgo($config)
{
    if (function_exists('mcrypt_list_algorithms')) {
        $listed = array();
        if (!isset($config['mcrypt_algo'])) {
            $config['mcrypt_algo'] = MCRYPT_TRIPLEDES;
        }
        $algos = mcrypt_list_algorithms();
        $found = False;
        $out = '';
        foreach ($algos as $algo) {
            $found = True;
            /* Only show each once - seems this is a problem in some installs */
            if (in_array($algo, $listed)) {
                continue;
            }
            $selected = '';
            if ($config['mcrypt_algo'] == $algo) {
                $selected = ' selected';
            }
            $descr = strtoupper($algo);
            $out .= "<option value=\"{$algo}\"{$selected}>{$descr}</option>\n";
            $listed[] = $algo;
        }
        if (!$found) {
            /* Something is wrong with their mcrypt install or php.ini */
            $out = '<option value="">' . lang('no algorithms available') . '</option>' . "\n";
        }
    } else {
        $out = '<option value="tripledes">TRIPLEDES</option>' . "\n";
    }
    return $out;
}
开发者ID:HaakonME,项目名称:porticoestate,代码行数:39,代码来源:hook_config.inc.php

示例8: Crypt_AES

 public function Crypt_AES($mode)
 {
     if (!defined("CRYPT_AES_MODE")) {
         switch (true) {
             case extension_loaded("mcrypt") && in_array("rijndael-128", mcrypt_list_algorithms()):
                 define("CRYPT_AES_MODE", CRYPT_AES_MODE_MCRYPT);
                 break;
             default:
                 define("CRYPT_AES_MODE", CRYPT_AES_MODE_INTERNAL);
         }
     }
     switch (CRYPT_AES_MODE) {
         case CRYPT_AES_MODE_MCRYPT:
             switch ($mode) {
                 case CRYPT_AES_MODE_ECB:
                     $this->paddable = true;
                     $this->mode = MCRYPT_MODE_ECB;
                     break;
                 case CRYPT_AES_MODE_CTR:
                     $this->mode = "ctr";
                     break;
                 case CRYPT_AES_MODE_CFB:
                     $this->mode = "ncfb";
                     break;
                 case CRYPT_AES_MODE_OFB:
                     $this->mode = MCRYPT_MODE_NOFB;
                     break;
                 case CRYPT_AES_MODE_CBC:
                 default:
                     $this->paddable = true;
                     $this->mode = MCRYPT_MODE_CBC;
             }
             break;
         default:
             switch ($mode) {
                 case CRYPT_AES_MODE_ECB:
                     $this->paddable = true;
                     $this->mode = CRYPT_RIJNDAEL_MODE_ECB;
                     break;
                 case CRYPT_AES_MODE_CTR:
                     $this->mode = CRYPT_RIJNDAEL_MODE_CTR;
                     break;
                 case CRYPT_AES_MODE_CFB:
                     $this->mode = CRYPT_RIJNDAEL_MODE_CFB;
                     break;
                 case CRYPT_AES_MODE_OFB:
                     $this->mode = CRYPT_RIJNDAEL_MODE_OFB;
                     break;
                 case CRYPT_AES_MODE_CBC:
                 default:
                     $this->paddable = true;
                     $this->mode = CRYPT_RIJNDAEL_MODE_CBC;
             }
     }
     CRYPT_AES_MODE;
     if (CRYPT_AES_MODE == CRYPT_AES_MODE_INTERNAL) {
         parent::Crypt_Rijndael($this->mode);
     }
 }
开发者ID:belerweb,项目名称:pigcms,代码行数:59,代码来源:Crypt_AES.php

示例9: listAlgorithms

 /**
  * @return array
  */
 public static function listAlgorithms()
 {
     if (!self::$listAlgorithms) {
         $algorithms = mcrypt_list_algorithms();
         self::$listAlgorithms = array_combine($algorithms, $algorithms);
     }
     return self::$listAlgorithms;
 }
开发者ID:lytc,项目名称:sloths,代码行数:11,代码来源:Mcrypt.php

示例10: Crypt_AES

 public function Crypt_AES($mode = CRYPT_AES_MODE_CBC)
 {
     if (!defined('CRYPT_AES_MODE')) {
         switch (true) {
             case extension_loaded('mcrypt') && in_array('rijndael-128', mcrypt_list_algorithms()):
                 define('CRYPT_AES_MODE', CRYPT_AES_MODE_MCRYPT);
                 break;
             default:
                 define('CRYPT_AES_MODE', CRYPT_AES_MODE_INTERNAL);
         }
     }
     switch (CRYPT_AES_MODE) {
         case CRYPT_AES_MODE_MCRYPT:
             switch ($mode) {
                 case CRYPT_AES_MODE_ECB:
                     $this->paddable = true;
                     $this->mode = MCRYPT_MODE_ECB;
                     break;
                 case CRYPT_AES_MODE_CTR:
                     $this->mode = 'ctr';
                     break;
                 case CRYPT_AES_MODE_CFB:
                     $this->mode = 'ncfb';
                     break;
                 case CRYPT_AES_MODE_OFB:
                     $this->mode = MCRYPT_MODE_NOFB;
                     break;
                 case CRYPT_AES_MODE_CBC:
                 default:
                     $this->paddable = true;
                     $this->mode = MCRYPT_MODE_CBC;
             }
             break;
         default:
             switch ($mode) {
                 case CRYPT_AES_MODE_ECB:
                     $this->paddable = true;
                     $this->mode = CRYPT_RIJNDAEL_MODE_ECB;
                     break;
                 case CRYPT_AES_MODE_CTR:
                     $this->mode = CRYPT_RIJNDAEL_MODE_CTR;
                     break;
                 case CRYPT_AES_MODE_CFB:
                     $this->mode = CRYPT_RIJNDAEL_MODE_CFB;
                     break;
                 case CRYPT_AES_MODE_OFB:
                     $this->mode = CRYPT_RIJNDAEL_MODE_OFB;
                     break;
                 case CRYPT_AES_MODE_CBC:
                 default:
                     $this->paddable = true;
                     $this->mode = CRYPT_RIJNDAEL_MODE_CBC;
             }
     }
     if (CRYPT_AES_MODE == CRYPT_AES_MODE_INTERNAL) {
         parent::Crypt_Rijndael($this->mode);
     }
 }
开发者ID:fkssei,项目名称:pigcms10,代码行数:58,代码来源:Crypt_AES.php

示例11: setAlgorithm

 /**
  *
  * @param $algorithm
  * @return Crypt
  */
 public function setAlgorithm($algorithm)
 {
     // Make sure algorythm is available
     if (!in_array($algorithm, mcrypt_list_algorithms())) {
         throw new Exception("MCRYPT Algorithm {$algorithm} is not available.");
     }
     $this->_algorithm = $algorithm;
     return $this;
 }
开发者ID:spekkionu,项目名称:spekkionu-php-class-collection,代码行数:14,代码来源:Crypt.php

示例12: checkEnvironment

 /**
  * Checks the environment for mcrypt and mcrypt module
  *
  * @return void
  * @author Osman Üngür
  */
 private function checkEnvironment()
 {
     if (!extension_loaded('mcrypt') || !function_exists('mcrypt_module_open')) {
         throw new Exception('The PHP mcrypt extension must be installed for encryption', 1);
     }
     if (!in_array(self::MCRYPT_MODULE, mcrypt_list_algorithms())) {
         throw new Exception("The cipher used self::MCRYPT_MODULE does not appear to be supported by the installed version of libmcrypt", 1);
     }
 }
开发者ID:mclkim,项目名称:kaiser,代码行数:15,代码来源:Crypt.php

示例13: verifyEnvironment

 /**
  * Validates mcrypt installation.
  *
  * @codeCoverageIgnore
  */
 private function verifyEnvironment()
 {
     if (!function_exists('mcrypt_module_open')) {
         throw new EnvironmentException('The cipher used, %1$s (also known as %2$s), requires libmcrypt version 2.4.x or newer. The version installed does not appear to meet this requirement.', 'AES-192', 'rijndael-192');
     }
     if (!in_array('rijndael-192', mcrypt_list_algorithms())) {
         throw new EnvironmentException('The cipher used, %1$s (also known as %2$s), does not appear to be supported by the installed version of libmcrypt', 'AES-192', 'rijndael-192');
     }
 }
开发者ID:Viacomino,项目名称:sutra,代码行数:14,代码来源:SymmetricKeyCryptography.php

示例14: getSupportedCiphers

 /**
  * Get a list of supported ciphers for this class implementation
  *
  * @return array A list of supported ciphers
  */
 public static function getSupportedCiphers()
 {
     // @codeCoverageIgnoreStart
     if (!function_exists('mcrypt_list_algorithms')) {
         return array();
     }
     // @codeCoverageIgnoreEnd
     return mcrypt_list_algorithms();
 }
开发者ID:nimasdj,项目名称:PHP-CryptLib,代码行数:14,代码来源:MCrypt.php

示例15: checkMcrypt

 private function checkMcrypt($algorithm, $secret)
 {
     if (!in_array($algorithm, mcrypt_list_algorithms())) {
         throw new CryptoProviderException("Algorithm '{$algorithm}' doesn't support by mcrypt extension");
     }
     if (strlen($secret) < self::SECRET_MIN_LENGHT) {
         throw new CryptoProviderException("Secret passphrase must have more than {self::SECRET_MIN_LENGHT} characters. But '{$secret}' was given");
     }
 }
开发者ID:point,项目名称:cassea,代码行数:9,代码来源:CryptoProvider.php


注:本文中的mcrypt_list_algorithms函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。