本文整理汇总了PHP中mcrypt_enc_get_algorithms_name函数的典型用法代码示例。如果您正苦于以下问题:PHP mcrypt_enc_get_algorithms_name函数的具体用法?PHP mcrypt_enc_get_algorithms_name怎么用?PHP mcrypt_enc_get_algorithms_name使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了mcrypt_enc_get_algorithms_name函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _mcrypt_initialize
/**
* Initialize MCrypt
*
* @param array $params Configuration parameters
* @return void
*/
protected function _mcrypt_initialize($params)
{
if (!empty($params['cipher'])) {
$params['cipher'] = strtolower($params['cipher']);
$this->_cipher_alias($params['cipher']);
if (!in_array($params['cipher'], mcrypt_list_algorithms(), TRUE)) {
log_message('error', 'Encryption: MCrypt cipher ' . strtoupper($params['cipher']) . ' is not available.');
} else {
$this->_cipher = $params['cipher'];
}
}
if (!empty($params['mode'])) {
$params['mode'] = strtolower($params['mode']);
if (!isset($this->_modes['mcrypt'][$params['mode']])) {
log_message('error', 'Encryption: MCrypt mode ' . strtoupper($params['mode']) . ' is not available.');
} else {
$this->_mode = $this->_modes['mcrypt'][$params['mode']];
}
}
if (isset($this->_cipher, $this->_mode)) {
if (is_resource($this->_handle) && (strtolower(mcrypt_enc_get_algorithms_name($this->_handle)) !== $this->_cipher or strtolower(mcrypt_enc_get_modes_name($this->_handle)) !== $this->_mode)) {
mcrypt_module_close($this->_handle);
}
if ($this->_handle = mcrypt_module_open($this->_cipher, '', $this->_mode, '')) {
log_message('info', 'Encryption: MCrypt cipher ' . strtoupper($this->_cipher) . ' initialized in ' . strtoupper($this->_mode) . ' mode.');
} else {
log_message('error', 'Encryption: Unable to initialize MCrypt with cipher ' . strtoupper($this->_cipher) . ' in ' . strtoupper($this->_mode) . ' mode.');
}
}
}
示例2: logfrm_proc
/**
| @name
| - logfrm_proc
|
| @params
| -
|
| @return
| -
|
| @description
| - process new user profile
|
**/
function logfrm_proc()
{
global $g_SYSTEM_DATA;
$this->etc->sec_logout();
//params
log_message("INFO", "logfrm_proc() : start here");
$chiphername = mcrypt_enc_get_algorithms_name($cipher);
$blocksize = mcrypt_enc_get_block_size($cipher);
$mykeysize = mcrypt_enc_get_supported_key_sizes($cipher);
log_message("INFO", "logfrm_proc() : {$chiphername}/{$blocksize} bytes ");
foreach ($mykeysize as $value) {
log_message("INFO", "logfrm_proc() : {$value} bytes ");
}
unset($value);
//sess
$dmp = @var_export($g_SYSTEM_DATA['_SESSION'], true);
//get chk post
$email = trim($this->input->post('email'));
$pass = trim($this->input->post('pass'));
$me = @intval(trim($this->input->post('me')));
//params
log_message("INFO", "logfrm_proc() : info-params [ {$email} : {$pass} : {$me} ] {$dmp};");
//cancel?
if (!$this->input->get_post('Login')) {
//set status
log_message("INFO", "logfrm_proc() : info [ NOT CLICKED ]");
//fwd
redirect(site_url(DEFAULT_LOGGED_IN_PAGE));
return;
}
//exec
$pdata = $this->etc->sec_login($email, $pass, $me);
$dmp = @var_export($pdata, true);
$by = $this->etc->get_name();
log_message("INFO", "logfrm_proc() : INFO-LOGIN [ {$dmp} ]");
if (!$pdata['status']) {
//set status
$smsg = intval($pdata['pdata']['data']->fieldtrial) >= intval($pdata['pdata']['data']->trial) ? $this->config->item('USER_LOGIN_ERROR_MAX') : $this->config->item('USER_LOGIN_ERROR');
$this->etc->set_error_message($smsg);
log_message("INFO", "logfrm_proc() : INFO-LOGIN-ERR [ {$smsg} ]");
//fwd
redirect(site_url(DEFAULT_LOGGED_IN_PAGE));
return;
}
//chk if its locked ???
if (intval($pdata['pdata']['data']->fieldtrial) >= intval($pdata['pdata']['data']->trial)) {
//max reached
$this->etc->set_error_message($this->config->item('USER_LOGIN_ERROR_MAX'));
log_message("INFO", "logfrm_proc() : INFO-LOGIN-ERR [ LOCKED ]");
//fwd
redirect(site_url(DEFAULT_LOGGED_IN_PAGE));
return;
}
//pass expired
if (intval($pdata['pdata']['data']->expired) > 0) {
//max reached
$this->etc->set_error_message($this->config->item('USER_LOGIN_PASS_EXPIRED'));
log_message("INFO", "logfrm_proc() : INFO-LOGIN-ERR [ PWD-EXPIRED ]");
//fwd
redirect(site_url(DEFAULT_LOGGED_IN_PAGE));
return;
}
//in-active
if (intval($pdata['pdata']['data']->flag_id) != 1) {
//max reached
$this->etc->set_error_message($this->config->item('USER_LOGIN_IN_ACTIVE'));
log_message("INFO", "logfrm_proc() : INFO-LOGIN-ERR [ IN-ACTIVE ]");
//fwd
redirect(site_url(DEFAULT_LOGGED_IN_PAGE));
return;
}
//flag_first=1, then fwd to change pass and NOT SUPER ROOT + can_change
if (intval($pdata['pdata']['data']->flagfirst) == 1 && intval($pdata['pdata']['data']->can_change) == 1 && intval($pdata['pdata']['data']->usertype) != DEFAULT_USERTYPE_ROOT_ID) {
/**
//FLAGFIRST++ ( HOW MANY TIMES LOGGED IN)
$this->secuser_model->set_column_ctr(array(
'id' => $pdata['pdata']['data']->user_id,
'by' => $by,
'col' => 'FLAGFIRST',
'val' => sprintf("%d",1+$pdata['pdata']['data']->flagfirst)));
**/
log_message("INFO", "afrm_proc() : INFO-LOGIN [ FLAGFIRST=1 ]");
redirect(site_url('secuser/chpass'));
return;
}
log_message("INFO", "afrm_proc() : login is GOOD [ goto admin ]");
//.........这里部分代码省略.........
示例3: VS
VS(trim((string) $decrypted), $CC);
//////////////////////////////////////////////////////////////////////
$key = "123456789012345678901234567890123456789012345678901234567890";
$CC = "4007000000027";
$encrypted = mcrypt_ofb(MCRYPT_RIJNDAEL_128, substr($key, 0, 32), $CC, MCRYPT_ENCRYPT, substr($key, 32, 16));
$decrypted = mcrypt_ofb(MCRYPT_RIJNDAEL_128, substr($key, 0, 32), $encrypted, MCRYPT_DECRYPT, substr($key, 32, 16));
VERIFY($encrypted !== $decrypted);
VS($decrypted, $CC);
//////////////////////////////////////////////////////////////////////
VS(mcrypt_get_block_size("tripledes", "ecb"), 8);
VS(mcrypt_get_cipher_name(MCRYPT_TRIPLEDES), "3DES");
VS(mcrypt_get_iv_size(MCRYPT_CAST_256, MCRYPT_MODE_CFB), 16);
VS(mcrypt_get_iv_size("des", "ecb"), 8);
VS(mcrypt_get_key_size("tripledes", "ecb"), 24);
$td = mcrypt_module_open("cast-256", "", "cfb", "");
VS(mcrypt_enc_get_algorithms_name($td), "CAST-256");
$td = mcrypt_module_open("tripledes", "", "ecb", "");
VS(mcrypt_enc_get_block_size($td), 8);
$td = mcrypt_module_open("cast-256", "", "cfb", "");
VS(mcrypt_enc_get_iv_size($td), 16);
$td = mcrypt_module_open("tripledes", "", "ecb", "");
VS(mcrypt_enc_get_key_size($td), 24);
$td = mcrypt_module_open("cast-256", "", "cfb", "");
VS(mcrypt_enc_get_modes_name($td), "CFB");
$td = mcrypt_module_open("rijndael-256", "", "ecb", "");
VS(mcrypt_enc_get_supported_key_sizes($td), array(16, 24, 32));
$td = mcrypt_module_open("tripledes", "", "ecb", "");
VS(mcrypt_enc_is_block_algorithm_mode($td), true);
$td = mcrypt_module_open("tripledes", "", "ecb", "");
VS(mcrypt_enc_is_block_algorithm($td), true);
$td = mcrypt_module_open("tripledes", "", "ecb", "");
示例4: mcrypt_module_open
<?php
$td = mcrypt_module_open('rijndael-128', '', MCRYPT_MODE_ECB, '');
echo mcrypt_enc_get_algorithms_name($td) . "\n";
$td = mcrypt_module_open(MCRYPT_RIJNDAEL_128, '', MCRYPT_MODE_ECB, '');
echo mcrypt_enc_get_algorithms_name($td) . "\n";
$td = mcrypt_module_open(MCRYPT_RC2, '', MCRYPT_MODE_CBC, '');
echo mcrypt_enc_get_algorithms_name($td) . "\n";
$td = mcrypt_module_open(MCRYPT_BLOWFISH, '', MCRYPT_MODE_CBC, '');
echo mcrypt_enc_get_algorithms_name($td) . "\n";
$td = mcrypt_module_open('des', '', 'ecb', '');
echo mcrypt_enc_get_algorithms_name($td) . "\n";
示例5: mcrypt_module_open
<?php
$td = mcrypt_module_open(MCRYPT_DES, '', MCRYPT_MODE_ECB, '');
mcrypt_generic_init($td, '', 'a');
var_dump(mcrypt_enc_get_algorithms_name($td));
var_dump(mcrypt_enc_get_block_size($td));
var_dump(mcrypt_enc_get_iv_size($td));
var_dump(mcrypt_enc_get_key_size($td));
var_dump(mcrypt_enc_get_modes_name($td));
var_dump(mcrypt_enc_get_supported_key_sizes($td));
var_dump(mcrypt_enc_self_test($td));
var_dump(mcrypt_generic_init($td, '', 'a'));