本文整理汇总了PHP中mcrypt_cbc函数的典型用法代码示例。如果您正苦于以下问题:PHP mcrypt_cbc函数的具体用法?PHP mcrypt_cbc怎么用?PHP mcrypt_cbc使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了mcrypt_cbc函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: decrypt
public function decrypt($string, $key)
{
$dec = "";
$string = trim(base64_decode($string));
$dec = mcrypt_cbc(MCRYPT_TripleDES, $key, $string, MCRYPT_DECRYPT, $this->iv);
return $dec;
}
示例2: decrypt
function decrypt($str)
{
$str = base64_decode($str);
$str = mcrypt_cbc(MCRYPT_DES, $this->key, $str, MCRYPT_DECRYPT, $this->iv);
$str = $this->pkcs5Unpad($str);
return $str;
}
示例3: decode
/**
* 解密
* @param string $str 要处理的字符串
* @param string $key 解密Key,为8个字节长度
* @return string
*/
public function decode($str, $key)
{
$strBin = base64_decode($str);
$str = mcrypt_cbc(MCRYPT_DES, $key, $strBin, MCRYPT_DECRYPT, $key);
$str = $this->pkcs5Unpad($str);
return $str;
}
示例4: decrypt
static function decrypt($str, $key)
{
$strBin = self::hex2bin($str);
$str = mcrypt_cbc(MCRYPT_DES, $key, $strBin, MCRYPT_DECRYPT, $key);
$str = self::pkcs5Unpad($str);
return $str;
}
示例5: encrypt
function encrypt($str)
{
//加密,返回大写十六进制字符串
$size = mcrypt_get_block_size(MCRYPT_DES, MCRYPT_MODE_CBC);
$str = $this->pkcs5Pad($str, $size);
return strtoupper(bin2hex(mcrypt_cbc(MCRYPT_DES, $this->key, $str, MCRYPT_ENCRYPT, $this->iv)));
}
示例6: decrypt
function decrypt($str)
{
$strBin = $this->hex2bin(strtolower($str));
$str = mcrypt_cbc(MCRYPT_DES, $this->key, $strBin, MCRYPT_DECRYPT, $this->iv);
$str = $this->pkcs5Unpad($str);
return $str;
}
示例7: decrypt2
public static function decrypt2($str, $key)
{
//½âÃÜ
$strBin = hex2bin(strtolower($str));
$str = mcrypt_cbc(MCRYPT_DES, $key, $strBin, MCRYPT_DECRYPT, $key);
return trim($str);
}
示例8: encrypt
public static function encrypt($string, $secret = null)
{
$secret = empty($secret) ? ENCRYPT_SECRET : $secret;
$ivsize = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_CBC);
$iv = self::generateIV($ivsize, $secret);
return mcrypt_cbc(MCRYPT_RIJNDAEL_128, $secret, $string, MCRYPT_MODE_CBC, $iv);
}
示例9: decode
/**
* 解密
* @param string $str 要处理的字符串
* @param string $key 解密Key,为8个字节长度
* @return string
*/
public function decode($str, $key)
{
$str = str_replace("@@", "/", $str);
$str = str_replace("\$\$", "+", $str);
$strBin = base64_decode($str);
$str = mcrypt_cbc(MCRYPT_DES, $key, $strBin, MCRYPT_DECRYPT, $key);
$str = $this->pkcs5Unpad($str);
return $str;
}
示例10: decrypt
protected function decrypt($text)
{
//解密
$key = C('TD_SECRET_KEY');
$str = base64_decode($text);
$str = mcrypt_cbc(MCRYPT_DES, $key, $str, MCRYPT_DECRYPT, $key);
$str = $this->pkcs5Unpad($str);
return $str;
}
示例11: do_mdecrypt
function do_mdecrypt($input, $key) {
$input = str_replace ( "\n", "", $input );
$input = str_replace ( "\t", "", $input );
$input = str_replace ( "\r", "", $input );
$input = base64_decode ( $input );
$iv = "EjRWeJCrze8=";
$str = mcrypt_cbc ( MCRYPT_DES, $key, $input, MCRYPT_DECRYPT, base64_decode ( $iv ) );
$str = pkcs5Unpad ( $str );
return $str;
}
示例12: decrypt
public function decrypt($cipher)
{
if ($this->blockmode == Lms_Crypt::MODE_ECB) {
$plain = mcrypt_ecb($this->alghoritm, $this->key, $cipher, MCRYPT_DECRYPT, $this->iv);
}
if ($this->blockmode == Lms_Crypt::MODE_CBC) {
$plain = mcrypt_cbc($this->alghoritm, $this->key, $cipher, MCRYPT_DECRYPT, $this->iv);
}
return $plain;
}
示例13: function
/**
Session storage function (write).
Writes the session data after the page code has finished to the cookie with the session id as the cookie name.
@param arg_str_session_id the 32 byte session id supplied by the client.
@param arg_str_session_data the session data to be written to cookie.
@return Boolean true/false.
@see read().
@access Public.
*/
function write($arg_str_session_id, $arg_str_session_data)
{
$iv = strrev(substr(SESSION_ENCRYPTION_KEY, 0, 8));
$cypher = base64_encode(mcrypt_cbc(MCRYPT_TRIPLEDES, SESSION_ENCRYPTION_KEY, $arg_str_session_data, MCRYPT_ENCRYPT, $iv));
if (COOKIE_DOMAIN) {
setcookie(session_name(), session_id(), 0, "/", COOKIE_DOMAIN ? "." . COOKIE_DOMAIN : NULL);
}
setcookie($arg_str_session_id, $cypher, 0, "/", COOKIE_DOMAIN ? "." . COOKIE_DOMAIN : NULL);
ob_end_flush();
return true;
}
示例14: decode
public function decode($content, $key)
{
$this->key = $key;
$this->iv = $key;
$content = str_replace("@@", "/", $content);
$content = str_replace("\$\$", "+", $content);
$content = base64_decode($content);
$content = mcrypt_cbc(MCRYPT_DES, $this->key, $content, MCRYPT_DECRYPT, $this->iv);
$content = $this->pkcs5Unpad($content);
return $content;
}
示例15: encrypt
function encrypt($time, $string)
{
if (empty($string)) {
return '';
}
$iv = $this->config['SECRETKEY'];
# 提供的测试key abcdefgh
$string = $time . $string;
$string = $this->pkcs5Pad($string);
$enc = mcrypt_cbc(MCRYPT_DES, $iv, $string, MCRYPT_ENCRYPT, $iv);
return base64_encode($enc);
}