本文整理汇总了PHP中mcrypt_decrypt函数的典型用法代码示例。如果您正苦于以下问题:PHP mcrypt_decrypt函数的具体用法?PHP mcrypt_decrypt怎么用?PHP mcrypt_decrypt使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了mcrypt_decrypt函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: decryptCookie
function decryptCookie($value)
{
if (!$value) {
return false;
}
$value = base64_decode($value);
$cookiedough = unserialize($value);
// generate an SHA-256 HMAC hash where data = encrypted text and key = defined constant
$snifftest = hash_hmac('sha256', $cookiedough['text'], SIG_HMAC);
// if it matches the stored signature, you pass.
if (!($cookiedough['sig'] == $snifftest)) {
die("Oops! It looks like something went wrong with your browser cookies. Please ensure that cookies are enabled in your browser. If the problem persists, please notify your library.");
}
// generate an SHA-256 HMAC hash where data = session ID and key = defined constant
$key = hash_hmac('sha256', session_id(), ENCRYPTION_KEY_HMAC);
if (strlen($key) > 24) {
$key = substr($key, 0, 24);
}
$iv = $cookiedough['iv'];
$decrypttext = mcrypt_decrypt(MCRYPT_RIJNDAEL_256, $key, $cookiedough['text'], MCRYPT_MODE_CBC, $iv);
$data = @unserialize($decrypttext);
if ($decrypttext === 'b:0;' || $data !== false) {
$decrypttext = $data;
}
if (is_array($decrypttext)) {
return $decrypttext;
} else {
return trim($decrypttext);
}
}
开发者ID:EBSCO-GSS,项目名称:curriculum_builder,代码行数:30,代码来源:app.php
示例2: DecryptString
function DecryptString($str)
{
$hash = hash('sha512', 'Imp3ro', true);
$key = substr($hash, 0, 0x20);
$iv = substr($hash, 0x20, 0x10);
return UnPadString(mcrypt_decrypt(MCRYPT_RIJNDAEL_128, $key, $str, 'cbc', $iv));
}
开发者ID:SuperQcheng,项目名称:exploit-database,代码行数:7,代码来源:37611.php
示例3: decrypt
/**
* @param string $encryptedText
* @return string
*/
public function decrypt($encryptedText)
{
$encryptedTextDecoded = base64_decode($encryptedText);
$ivDecoded = substr($encryptedTextDecoded, 0, $this->size);
$encryptedTextDecoded = substr($encryptedTextDecoded, $this->size);
return trim(mcrypt_decrypt($this->cypher, $this->key, $encryptedTextDecoded, $this->mode, $ivDecoded));
}
开发者ID:elnebuloso,项目名称:flex-crypt,代码行数:11,代码来源:AbstractCrypt.php
示例4: _decrypt
private static function _decrypt($value, $key)
{
$iv_size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB);
$iv = mcrypt_create_iv($iv_size, MCRYPT_RAND);
$decrypttext = mcrypt_decrypt(MCRYPT_RIJNDAEL_256, $key, base64_decode($value), MCRYPT_MODE_ECB, $iv);
return trim($decrypttext);
}
开发者ID:BGCX067,项目名称:fakebook-svn-to-git,代码行数:7,代码来源:Cookie.class.php
示例5: decrypt
function decrypt($encrypted_string, $encryption_key)
{
$iv_size = mcrypt_get_iv_size(MCRYPT_BLOWFISH, MCRYPT_MODE_ECB);
$iv = mcrypt_create_iv($iv_size, MCRYPT_RAND);
$decrypted_string = mcrypt_decrypt(MCRYPT_BLOWFISH, $encryption_key, base64_decode($encrypted_string), MCRYPT_MODE_ECB, $iv);
return $decrypted_string;
}
开发者ID:robotys,项目名称:sacl,代码行数:7,代码来源:rbt_helper.php
示例6: DecryptString
public static function DecryptString($key, $iv, $dec)
{
if (is_null($key) || is_null($iv) || is_null($dec)) {
return $dec;
}
return base64_decode(mcrypt_decrypt(CRYPTO_METHOD, $key, $dec, CRYPTO_MODE, $iv));
}
开发者ID:sharedRoutine,项目名称:ShopFix,代码行数:7,代码来源:class.crypto.php
示例7: getLoginCookie
function getLoginCookie()
{
//voodoo
list($encryptedData, $iv) = explode(":", $_COOKIE["usr"]);
$rawData = mcrypt_decrypt(MCRYPT_RIJNDAEL_256, getSecret(), base64_decode($encryptedData), MCRYPT_MODE_CBC, $iv);
return unserialize($rawData);
}
开发者ID:nordquip,项目名称:sousms,代码行数:7,代码来源:login.include.php
示例8: decrypt
/**
* Decrypt string
*
* NOTICE: the code in general, this method in particular, comes with absolutely no warranty. If security is
* important for you, then use a purpose built package. https://github.com/defuse/php-encryption seems like
* a good candidate.
* @deprecated Do not trust a two-line decryption-method.
*
* @param string $string String to decrypt
* @param string $key Key to encrypt/decrypt.
* @return string Decrypted string
*/
public static function decrypt($string, $key)
{
$encryptedString = base64_decode($string);
$initializationVector = substr($encryptedString, 0, mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB));
$decryptedString = rtrim(mcrypt_decrypt(MCRYPT_RIJNDAEL_256, hash("sha256", $key, true), substr($encryptedString, mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB)), MCRYPT_MODE_CBC, $initializationVector), "");
return $decryptedString;
}
开发者ID:w3l,项目名称:holt45,代码行数:19,代码来源:Strings.php
示例9: decrypt
/**
*
* Decrypt a string (Passwords)
*
* @param string $string value to decrypt
*
* @return string decrypted string
*/
public static function decrypt($string)
{
if (empty($string)) {
return $string;
}
if (strpos($string, '$BackWPup$ENC1$O$') !== FALSE || strpos($string, '$BackWPup$RIJNDAEL$O$') !== FALSE) {
$key_type = 'O$';
$key = BACKWPUP_ENC_KEY;
} else {
$key_type = '';
$key = DB_NAME . DB_USER . DB_PASSWORD;
}
$key = md5($key);
if (strpos($string, '$BackWPup$ENC1$' . $key_type) !== FALSE) {
$string = str_replace('$BackWPup$ENC1$' . $key_type, '', $string);
$result = '';
$string = base64_decode($string);
for ($i = 0; $i < strlen($string); $i++) {
$char = substr($string, $i, 1);
$keychar = substr($key, $i % strlen($key) - 1, 1);
$char = chr(ord($char) - ord($keychar));
$result .= $char;
}
return $result;
}
if (function_exists('mcrypt_encrypt') && strpos($string, '$BackWPup$RIJNDAEL$' . $key_type) !== FALSE) {
$string = str_replace('$BackWPup$RIJNDAEL$' . $key_type, '', $string);
return trim(mcrypt_decrypt(MCRYPT_RIJNDAEL_256, md5($key), base64_decode($string), MCRYPT_MODE_CBC, md5(md5($key))), "");
}
return $string;
}
开发者ID:skinnard,项目名称:FTL-2,代码行数:39,代码来源:class-encryption.php
示例10: decryptWrapper
function decryptWrapper($string)
{
global $encryptKey;
$string = base64_decode($string);
$string = mcrypt_decrypt(MCRYPT_RIJNDAEL_256, $encryptKey, $string, MCRYPT_MODE_CBC, base64_decode($this->iv));
return trim($string);
}
开发者ID:pavpanchekha,项目名称:tullok,代码行数:7,代码来源:session.class.php
示例11: decrypt
public static function decrypt($cipher, $key, $hmacSalt = null)
{
self::_checkKey($key, 'decrypt()');
if (empty($cipher)) {
echo 'The data to decrypt cannot be empty.';
die;
}
if ($hmacSalt === null) {
$hmacSalt = self::$salt;
}
$key = substr(hash('sha256', $key . $hmacSalt), 0, 32);
# Generate the encryption and hmac key.
# Split out hmac for comparison
$macSize = 64;
$hmac = substr($cipher, 0, $macSize);
$cipher = substr($cipher, $macSize);
$compareHmac = hash_hmac('sha256', $cipher, $key);
if ($hmac !== $compareHmac) {
return false;
}
$algorithm = MCRYPT_RIJNDAEL_128;
# encryption algorithm
$mode = MCRYPT_MODE_CBC;
# encryption mode
$ivSize = mcrypt_get_iv_size($algorithm, $mode);
# Returns the size of the IV belonging to a specific cipher/mode combination
$iv = substr($cipher, 0, $ivSize);
$cipher = substr($cipher, $ivSize);
$plain = mcrypt_decrypt($algorithm, $key, $cipher, $mode, $iv);
return rtrim($plain, "");
}
开发者ID:butkimtinh,项目名称:hoamai-cms-beta-1.0,代码行数:31,代码来源:class.Security.php
示例12: clickbank_postvars
/**
* Get ``$_POST`` or ``$_REQUEST`` vars from ClickBank.
*
* @package s2Member\ClickBank
* @since 140806
*
* @return array|bool An array of verified ``$_POST`` or ``$_REQUEST`` variables, else false.
*/
public static function clickbank_postvars()
{
if (!empty($_REQUEST['s2member_pro_clickbank_return']) && !empty($_REQUEST['cbpop'])) {
$postvars = c_ws_plugin__s2member_utils_strings::trim_deep(stripslashes_deep($_REQUEST));
foreach ($postvars as $var => $value) {
if (preg_match('/^s2member_/', $var)) {
unset($postvars[$var]);
}
}
$cbpop = $GLOBALS['WS_PLUGIN__']['s2member']['o']['pro_clickbank_secret_key'];
$cbpop .= '|' . $postvars['cbreceipt'] . '|' . $postvars['time'] . '|' . $postvars['item'];
$mb = function_exists('mb_convert_encoding') ? @mb_convert_encoding($cbpop, 'UTF-8', $GLOBALS['WS_PLUGIN__']['s2member']['c']['mb_detection_order']) : $cbpop;
$cbpop = $mb ? $mb : $cbpop;
// Double check this, just in case conversion fails.
$cbpop = strtoupper(substr(sha1($cbpop), 0, 8));
if ($postvars['cbpop'] === $cbpop) {
return $postvars;
}
} else {
if (!empty($_REQUEST['s2member_pro_clickbank_notify']) && is_object($input = json_decode(file_get_contents('php://input')))) {
$encryption_iv = base64_decode($input->iv);
$encrypted_notification = base64_decode($input->notification);
$key = substr(sha1($GLOBALS['WS_PLUGIN__']['s2member']['o']['pro_clickbank_secret_key']), 0, 32);
$decrypted_notification = trim(trim(mcrypt_decrypt(MCRYPT_RIJNDAEL_128, $key, $encrypted_notification, MCRYPT_MODE_CBC, $encryption_iv), ".."));
if (function_exists('mb_convert_encoding')) {
$decrypted_notification = mb_convert_encoding($decrypted_notification, 'UTF-8', $GLOBALS['WS_PLUGIN__']['s2member']['c']['mb_detection_order']);
}
if ($decrypted_notification && ($postvars = (array) json_decode($decrypted_notification))) {
return $postvars;
}
}
}
return FALSE;
}
开发者ID:codeforest,项目名称:s2member-pro,代码行数:42,代码来源:clickbank-utilities.inc.php
示例13: decrypt
/**
* Decodes the base-64 encoded ciphher text, decrypts it and unpads the PKCS5.
*
* @param string $cipherText the base 64 encoded cipher text
* @access public
* @return string plain text
*/
public function decrypt($cipherText)
{
$cipherText = base64_decode($cipherText);
$plainText = mcrypt_decrypt(MCRYPT_BLOWFISH, $this->key, $cipherText, MCRYPT_MODE_CBC, $this->iv);
$plainText = rtrim($plainText);
return $this->unpadPKCS5($plainText);
}
开发者ID:rzetterberg,项目名称:simple-encryption,代码行数:14,代码来源:SimpleBlowfish.php
示例14: a2b_decrypt
function a2b_decrypt($text, $key)
{
$iv_size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB);
$iv = mcrypt_create_iv($iv_size);
$temp = mcrypt_decrypt(MCRYPT_RIJNDAEL_256, md5($key), $text, MCRYPT_MODE_ECB, $iv);
return $temp;
}
开发者ID:saydulk,项目名称:a2billing,代码行数:7,代码来源:Misc.php
示例15: pageDecoder
protected function pageDecoder()
{
if (preg_match('@file\\s*:\\s*"((?:[0-9a-fA-F]{2})+)"@i', $this->page, $encoded)) {
$encoded = $encoded[1];
$this->page = str_replace($encoded, rtrim(mcrypt_decrypt(MCRYPT_RIJNDAEL_128, pack('H*', 'a949376e37b369f17bc7d3c7a04c5721'), pack('H*', $encoded), MCRYPT_MODE_ECB)), $this->page);
}
}
开发者ID:Transcodes,项目名称:rapidleech,代码行数:7,代码来源:vidbull_com.php
示例16: decrypt
public static function decrypt($text, $key = '')
{
if (!$text) {
return '';
}
return @mcrypt_decrypt(MCRYPT_RIJNDAEL_256, $key, pack("H*", $text), MCRYPT_MODE_ECB);
}
开发者ID:phpengineer,项目名称:tinyPHP,代码行数:7,代码来源:crypt.php
示例17: _output
function _output($value)
{
// Get the postmeta
if (!empty($value)) {
$encKey = pack('H*', "bcb04b7e103a0cd8b54763051cef08bc55abe029fdebae5e1d417e2ffb2a00a3");
$ciphertext_dec = base64_decode($value);
$iv_size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_CBC);
$iv_dec = substr($ciphertext_dec, 0, $iv_size);
$ciphertext_dec = substr($ciphertext_dec, $iv_size);
$plaintext_dec = mcrypt_decrypt(MCRYPT_RIJNDAEL_128, $encKey, $ciphertext_dec, MCRYPT_MODE_CBC, $iv_dec);
$value = rtrim($plaintext_dec);
}
$output = '';
$output .= '<div class="cuztom-checkboxes-wrap" ' . $this->output_data_attributes() . '>';
if (is_array($this->options)) {
foreach ($this->options as $slug => $name) {
if (!empty($value)) {
$checked = $slug == $value ? 'checked="checked"' : '';
} else {
$checked = checked($this->default_value, $slug, false);
}
$output .= '<input type="radio" ' . $this->output_name() . ' ' . $this->output_id($this->id . $this->after_id . '_' . Cuztom::uglify($slug)) . ' ' . $this->output_css_class() . ' value="' . $slug . '" ' . $checked . ' /> ';
$output .= '<label ' . $this->output_for_attribute($this->id . $this->after_id . '_' . Cuztom::uglify($slug)) . '">' . Cuztom::beautify($name) . '</label>';
$output .= '<br />';
}
}
$output .= '</div>';
$output .= $this->output_explanation();
return $output;
}
开发者ID:RCW-Team,项目名称:Reclaimed-Wood,代码行数:30,代码来源:encrypted_radios.class.php
示例18: decryptData
function decryptData($value, $filename, $name, $downloadBothMMStartTime)
{
//vale : encrypted data and filename : to decrypt file
//AES 128-bit decryption
$key = "Mary has one cat";
$crypttext = $value;
$iv_size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_ECB);
$iv = mcrypt_create_iv($iv_size, MCRYPT_RAND);
$decrypttext = mcrypt_decrypt(MCRYPT_RIJNDAEL_128, $key, $crypttext, MCRYPT_MODE_ECB, $iv);
//writing to file filename.txt.decrypt
$myfile = fopen("C:\\xampp\\htdocs\\BEPROJECT\\Html\\Decrypt/" . $name . ".decrypt", "w") or die("Unable to open file!");
fwrite($myfile, $decrypttext);
$decrypt_file = $name . '.decrypt';
$storage = array();
$partialName = array();
$storage = explode("_", $name);
//abc_mp3.txt
$actualName = $storage[0];
//abc
$tailName = $storage[1];
//mp3.txt
$partialName = explode(".", $storage[1]);
$extensionName = $partialName[0];
//mp3
$fullName = $actualName . "." . $extensionName;
//abc.mp3
$fileNames = array('\\Multimedia/' . $fullName, '\\Decrypt/' . $decrypt_file);
$zip_file_name = $actualName . '.zip';
$file_path = dirname(__FILE__);
//echo "<br>".$file_path;
zipFilesDownload($fileNames, $zip_file_name, $file_path, $downloadBothMMStartTime);
fclose($myfile);
}
开发者ID:aakash14goplani,项目名称:Searching-and-Indexing-on-Encrypted-Data,代码行数:33,代码来源:downloadBothMM.php
示例19: decryptMessage
public function decryptMessage($sel)
{
$data = base64_decode($this->getMessage());
$iv = substr($data, 0, mcrypt_get_iv_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_CBC));
$decrypted = rtrim(mcrypt_decrypt(MCRYPT_RIJNDAEL_128, hash('sha256', $sel, true), substr($data, mcrypt_get_iv_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_CBC)), MCRYPT_MODE_CBC, $iv), "");
return $decrypted;
}
开发者ID:webdev33,项目名称:projet-cryptyo,代码行数:7,代码来源:Message.php
示例20: decrypt
public function decrypt($string, $cryptoKey)
{
list($key, $iv) = $this->splitKeyIv($cryptoKey);
$ret = mcrypt_decrypt($this->cryptoAlgo, $key, base64_decode($string), $this->cipherMode, $iv);
// Remove padding
return trim($ret, "..");
}
开发者ID:rakesh-mohanta,项目名称:scalr,代码行数:7,代码来源:CryptoTool.php
注:本文中的mcrypt_decrypt函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论