original_string: protected function decrypt($string)
  	{
  		// only if we want the cookie to be encrypted
  		if ($this->config['cookie']['encrypt_cookie'])
  		{
  			// we require the mcrypt PECL extension for this
  			if ( ! function_exists('mcrypt_decrypt'))
  			{
  				throw new \BadMethodCallException('The Session Cookie driver requires the PHP mcrypt extension to be installed.');
  			}
  
  			// create the encyption key
  			$key = hash('SHA256', $this->config['cookie']['crypt_key'], true);
  
  			// key the IV from the payload
  			$iv = base64_decode(substr($string, 0, 22) . '==');
  			$string = substr($string, 22);
  
  			// decrypt the payload
  			$string = rtrim(mcrypt_decrypt(MCRYPT_RIJNDAEL_128, $key, base64_decode($string), MCRYPT_MODE_CBC, $iv), "\0\4");
  
  			// split the hash from the payload
  			$hash = substr($string, -32);
  			$string = substr($string, 0, -32);
  
  			// double-check it wasn't tampered with
  			if (md5($string) != $hash)
  			{
  				return false;
  			}
  		}
  
  		return $string;
  	}
code: protected function decrypt($string)
  	{
  		// only if we want the cookie to be encrypted
  		if ($this->config['cookie']['encrypt_cookie'])
  		{
  			// we require the mcrypt PECL extension for this
  			if ( ! function_exists('mcrypt_decrypt'))
  			{
  				throw new \BadMethodCallException('The Session Cookie driver requires the PHP mcrypt extension to be installed.');
  			}
  
  			// create the encyption key
  			$key = hash('SHA256', $this->config['cookie']['crypt_key'], true);
  
  			// key the IV from the payload
  			$iv = base64_decode(substr($string, 0, 22) . '==');
  			$string = substr($string, 22);
  
  			// decrypt the payload
  			$string = rtrim(mcrypt_decrypt(MCRYPT_RIJNDAEL_128, $key, base64_decode($string), MCRYPT_MODE_CBC, $iv), "\0\4");
  
  			// split the hash from the payload
  			$hash = substr($string, -32);
  			$string = substr($string, 0, -32);
  
  			// double-check it wasn't tampered with
  			if (md5($string) != $hash)
  			{
  				return false;
  			}
  		}
  
  		return $string;
  	}
code_tokens: protected function decrypt ( $ string ) { // only if we want the cookie to be encrypted if ( $ this -> config [ 'cookie' ] [ 'encrypt_cookie' ] ) { // we require the mcrypt PECL extension for this if ( ! function_exists ( 'mcrypt_decrypt' ) ) { throw new \ BadMethodCallException ( 'The Session Cookie driver requires the PHP mcrypt extension to be installed.' ) ; } // create the encyption key $ key = hash ( 'SHA256' , $ this -> config [ 'cookie' ] [ 'crypt_key' ] , true ) ; // key the IV from the payload $ iv = base64_decode ( substr ( $ string , 0 , 22 ) . '==' ) ; $ string = substr ( $ string , 22 ) ; // decrypt the payload $ string = rtrim ( mcrypt_decrypt ( MCRYPT_RIJNDAEL_128 , $ key , base64_decode ( $ string ) , MCRYPT_MODE_CBC , $ iv ) , "\0\4" ) ; // split the hash from the payload $ hash = substr ( $ string , - 32 ) ; $ string = substr ( $ string , 0 , - 32 ) ; // double-check it wasn't tampered with if ( md5 ( $ string ) != $ hash ) { return false ; } } return $ string ; }
docstring: Decrypts a string using the crypt_key configured in the config
  
  @param string $string
  
  @return string
  
  @throws \BadMethodCallException  if the required mcrypt extension is not installed
docstring_tokens: Decrypts a string using the crypt_key configured in the config