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


PHP c_ws_plugin__s2member_utils_encryption::xdecrypt方法代码示例

本文整理汇总了PHP中c_ws_plugin__s2member_utils_encryption::xdecrypt方法的典型用法代码示例。如果您正苦于以下问题:PHP c_ws_plugin__s2member_utils_encryption::xdecrypt方法的具体用法?PHP c_ws_plugin__s2member_utils_encryption::xdecrypt怎么用?PHP c_ws_plugin__s2member_utils_encryption::xdecrypt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在c_ws_plugin__s2member_utils_encryption的用法示例。


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

示例1: s2member_xdecrypt

 function s2member_xdecrypt($base64 = FALSE, $key = FALSE)
 {
     return c_ws_plugin__s2member_utils_encryption::xdecrypt($base64, $key);
 }
开发者ID:EliasGoldberg,项目名称:troop-sim,代码行数:4,代码来源:api-functions.inc.php

示例2: decrypt

 /**
  * RIJNDAEL 256: two-way encryption/decryption, with a URL-safe base64 wrapper.
  *
  * Falls back on XOR encryption/decryption when mcrypt is not available.
  *
  * @package s2Member\Utilities
  * @since 3.5
  *
  * @param str $base64 A string of data to decrypt. Should still be base64 encoded.
  * @param str $key Optional. Key used originally for encryption. Defaults to the one configured for s2Member. Short of that, defaults to: ``wp_salt()``.
  * @return str Decrypted string.
  */
 public static function decrypt($base64 = FALSE, $key = FALSE)
 {
     $base64 = is_string($base64) ? $base64 : "";
     $e = strlen($base64) ? c_ws_plugin__s2member_utils_strings::base64_url_safe_decode($base64) : "";
     if (function_exists("mcrypt_decrypt") && in_array("rijndael-256", mcrypt_list_algorithms()) && in_array("cbc", mcrypt_list_modes()) && strlen($e) && preg_match("/^~r2\\:([a-zA-Z0-9]+)(?:\\:([a-zA-Z0-9]+))?\\|(.*?)\$/s", $e, $iv_md5_e)) {
         $key = c_ws_plugin__s2member_utils_encryption::key($key);
         $key = substr($key, 0, mcrypt_get_key_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_CBC));
         if (strlen($iv_md5_e[3]) && (!$iv_md5_e[2] || $iv_md5_e[2] === md5($iv_md5_e[3]))) {
             $d = mcrypt_decrypt(MCRYPT_RIJNDAEL_256, $key, $iv_md5_e[3], MCRYPT_MODE_CBC, $iv_md5_e[1]);
         }
         if (isset($d) && is_string($d) && strlen($d)) {
             if (strlen($d = preg_replace("/^~r2\\|/", "", $d, 1, $r2)) && $r2) {
                 $d = rtrim($d, "");
             } else {
                 // Else we need to empty this out.
                 $d = "";
             }
         }
         return isset($d) && is_string($d) && strlen($d) ? $string = $d : "";
     } else {
         // Fallback on XOR decryption.
         return c_ws_plugin__s2member_utils_encryption::xdecrypt($base64, $key);
     }
 }
开发者ID:donwea,项目名称:nhap.org,代码行数:36,代码来源:utils-encryption.inc.php

示例3: decrypt

 /**
  * RIJNDAEL 256: two-way encryption/decryption, with a URL-safe base64 wrapper.
  *
  * Falls back on XOR encryption/decryption when mcrypt is not available.
  *
  * @package s2Member\Utilities
  * @since 3.5
  *
  * @param string $base64 A string of data to decrypt. Should still be base64 encoded.
  * @param string $key Optional. Key used originally for encryption. Defaults to the one configured for s2Member. Short of that, defaults to: ``wp_salt()``.
  *
  * @return string Decrypted string.
  */
 public static function decrypt($base64 = '', $key = '')
 {
     $base64 = is_string($base64) ? $base64 : '';
     $e = isset($base64[0]) ? c_ws_plugin__s2member_utils_strings::base64_url_safe_decode($base64) : '';
     if (function_exists('mcrypt_decrypt') && in_array('rijndael-256', mcrypt_list_algorithms()) && in_array('cbc', mcrypt_list_modes())) {
         if (isset($e[0]) && preg_match('/^~r2\\:([a-zA-Z0-9]+)(?:\\:([a-zA-Z0-9]+))?\\|(.*)$/s', $e, $iv_md5_e)) {
             $key = c_ws_plugin__s2member_utils_encryption::key($key);
             $key = substr($key, 0, mcrypt_get_key_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_CBC));
             if (isset($iv_md5_e[3][0]) && (empty($iv_md5_e[2]) || $iv_md5_e[2] === md5($iv_md5_e[3]))) {
                 $d = mcrypt_decrypt(MCRYPT_RIJNDAEL_256, $key, $iv_md5_e[3], MCRYPT_MODE_CBC, $iv_md5_e[1]);
             }
             if (isset($d) && is_string($d) && isset($d[0])) {
                 if (strlen($d = preg_replace('/^~r2\\|/', '', $d, 1, $r2)) && $r2) {
                     $d = rtrim($d, "");
                 } else {
                     $d = '';
                 }
             }
             // Force empty string; bad decryption.
             return isset($d) && is_string($d) && isset($d[0]) ? $string = $d : '';
             // Default to empty string.
         }
     }
     return c_ws_plugin__s2member_utils_encryption::xdecrypt($base64, $key);
 }
开发者ID:adnandot,项目名称:intenseburn,代码行数:38,代码来源:utils-encryption.inc.php


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