public static function decrypt($text)
 {
     $use_mcrypt = apply_filters('gform_use_mcrypt', function_exists('mcrypt_decrypt'));
     if ($use_mcrypt) {
         $iv_size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB);
         $key = substr(md5(wp_salt('nonce')), 0, $iv_size);
         $decrypted_value = trim(mcrypt_decrypt(MCRYPT_RIJNDAEL_256, $key, base64_decode($text), MCRYPT_MODE_ECB, mcrypt_create_iv($iv_size, MCRYPT_RAND)));
     } else {
         $decrypted_value = EncryptDB::decrypt($text, wp_salt('nonce'));
     }
     return $decrypted_value;
 }
예제 #2
0
 public static function decrypt($text, $key = null, $mcrypt_cipher_name = false)
 {
     $use_mcrypt = apply_filters('gform_use_mcrypt', function_exists('mcrypt_decrypt'));
     if ($use_mcrypt) {
         $mcrypt_cipher_name = $mcrypt_cipher_name === false ? MCRYPT_RIJNDAEL_256 : $mcrypt_cipher_name;
         $iv_size = mcrypt_get_iv_size($mcrypt_cipher_name, MCRYPT_MODE_ECB);
         $key = !is_null($key) ? $key : substr(md5(wp_salt('nonce')), 0, $iv_size);
         $decrypted_value = trim(mcrypt_decrypt($mcrypt_cipher_name, $key, base64_decode($text), MCRYPT_MODE_ECB, mcrypt_create_iv($iv_size, MCRYPT_RAND)));
     } else {
         $decrypted_value = EncryptDB::decrypt($text, wp_salt('nonce'));
     }
     return $decrypted_value;
 }