Alternative decryption using Pure PHP Libraries
@http://px.sklar.com/code.html/id=1287
Fix and added More Secure Method

@param  string $string  string to be decode
@param  mixed  $pass     the hash key
@return mixed        decryption value output
510282
public static function altDecrypt($string, $pass = '')
    {
        // if has $enc or invalid no value or not as string stop here
        if (!is_string($string) || strlen(trim($string)) < 4
            || (strlen($string) > 10 ? (substr($string, 10, 5) !== '_aCb=') : (substr($string, 2, 5) !== '_aCb='))
        ) {
            // check if mCrypt loaded and crypt using mCrypt
            if (is_string($string)
                && strlen(trim($string)) > 3
                && extension_loaded('mCrypt')
                && (strlen($string) > 10 ? (substr($string, 10, 5) === '_mCb=') : (substr($string, 2, 5) === '_mCb='))
            ) {
                return static::decrypt($string, $pass);
            }

            return null;
        }

        /**
         * Replace Injection 3 characters sign
         */
        $string = (strlen($string) > 10
            ? substr_replace($string, '', 10, 5)
            : substr_replace($string, '', 2, 5)
        );

        // this is base64 safe encoded?
        if (preg_match('/[^a-z0-9\+\/\=\-\_]/i', $string)) {
            return null;
        }

        /**
         * ------------------------------------
         * Safe Sanitized
         * ------------------------------------
         */
        (is_null($pass) || $pass === false) && $pass = '';
        // safe is use array orobject as hash
        $pass = Util::maybeSerialize($pass);
        if (!$pass) {
            $pass = sha1($pass);
        }
        
        /**
         * Doing decode of input encryption
         */
        $string = Util::safeBase64Decode($string);

        /**
         * ------------------------------------
         * Doing convert encrypted string
         * ------------------------------------
         */
        $enc_arr  = str_split($string);
        $add = 0;
        $div = strlen($string) / strlen($pass);
        $new_pass = '';
        while ($add <= $div) {
            $new_pass .= $pass;
            $add++;
        }
        $pass_arr = str_split($new_pass);
        $ascii ='';
        foreach ($enc_arr as $key => $asc) {
            $pass_int = ord($pass_arr[$key]);
            $enc_int = ord($asc);
            $str_int = $enc_int - $pass_int;
            $ascii .= chr(($str_int-strlen($string)));
        }

        /* --------------------------------
         * reversing
         * ------------------------------ */
        // unpack
        $unpack = unpack('a*', trim($ascii));
        /**
         * if empty return here
         */
        if (!$unpack) {
            return null;
        }

        // implode the unpacking array
        $unpack = implode('', (array) $unpack);
        /**
         * Doing decode of input encryption from unpacked
         */
        $unpack = Util::safeBase64Decode($unpack);

        /**
         * Reverse Rotate
         */
        $retval = Util::rotate($unpack, 13);
        /**
         * For some case packing returning invisible characters
         * remove it
         */
        $retval = Util::removeInvisibleCharacters($retval, false);
        // check if string less than 40 && match end of hash
        if (strlen($retval) < 40 || substr($retval, -40) !== sha1(sha256::hash($pass))) {
            return null;
        }
        // remove last 40 characters
        $retval = substr($retval, 0, (strlen($retval)-40));
        // check if result is not string it will be need to be unserialize
        $retval = Util::maybeUnSerialize($retval);

        /**
         * Check if value is array
         */
        if (is_array($retval) && array_key_exists('acb', $retval)) {
            return $retval['acb'];
        }

        // freed the memory
        unset($retval);

        return null;
    }
344055
public static function decode($string)
    {
        if (!$string) {
            return new ArrayObject();
        }

        try {
            $array = unserialize($string);
        } catch (\Exception $e) {
            throw new PhpException("Serialize Error: " . $e->getMessage());
        }

        if (!is_array($array)) {
            $array = [];
        }

        return ArrayObject::make($array);
    }
684305
public static function altEncrypt($str, $pass = '')
    {
        /**
         * if empty values return null
         */
        if (!$str) {
            return null;
        }

        /**
         * ------------------------------------
         * Safe Sanitized hash
         * ------------------------------------
         */
        (is_null($pass) || $pass === false) && $pass = '';
        // safe is use array or object as hash
        $pass = Util::maybeSerialize($pass);
        if (!$pass) {
            $pass = sha1($pass);
        }

        // make an array values -> use key acb
        $str = serialize(array('acb' => $str));
        // rotate 13
        $str = pack('a*', Util::rotate($str.sha1(sha256::hash($pass)), 13));

        /**
         * Doing safe encode base 64
         */
        $str = Util::safeBase64Encode($str);

        /**
         * ------------------------------------
         * Doing convert string
         * ------------------------------------
         */
        $str_arr  = str_split($str);
        $add = 0;
        $div = strlen($str) / strlen($pass);
        $new_pass = '';
        while ($add <= $div) {
            $new_pass .= $pass;
            $add++;
        }
        $pass_arr = str_split($new_pass);
        $ascii = '';
        foreach ($str_arr as $key => $asc) {
            $pass_int = ord($pass_arr[$key]);
            $str_int = ord($asc);
            $int_add = $str_int + $pass_int;
            $ascii .= chr(($int_add+strlen($str)));
        }
        $ascii = trim(Util::safeBase64Encode($ascii));

        /**
         * ------------------------------------
         * Inject Result of with sign
         * ------------------------------------
         */
        if (strlen($ascii) > 10) {
            return substr_replace($ascii, '_aCb=', 10, 0);
        } else {
            return substr_replace($ascii, '_aCb=', 2, 0);
        }
    }
1176959
public function decryptBinary(string $value, string $key): string
    {
        $iv = substr($value, 0, $this->ivLength);
        $encrypted = substr($value, $this->ivLength);
        $key = $this->hashKey($key);
        $opts = OPENSSL_RAW_DATA | OPENSSL_ZERO_PADDING;
        $ret = openssl_decrypt($encrypted, $this->cipher, $key, $opts, $iv);
        if ($ret === false) {
            throw new \Exception("decryption failed; ".openssl_error_string());
        }
        return $ret;
    }
648404
public function decodeId($string = '')
    {
        if (empty($string)) {
            return NULL;
        }
        try {
            $hash   = new Hashids($this->hashIds['salt'], $this->hashIds['minHashLength'], $this->hashIds['alphabet']);
            $decode = $hash->decode($string);
            if (count($decode) > 1) {
                return $decode;
            }

            return $decode[0];
        }
        catch (\Exception $e) {
            if (function_exists('log_message')) {
                $message = 'Error Code: ' . $e->getCode() . ' - File: ' . $e->getFile() . ' - Line: ' . $e->getLine() . ' - Message: ' . $e->getMessage();
                log_message('error', $message);
            }

            return NULL;
        }
    }
510918
public static function decrypt($string, $hash = false)
    {
        // if has $string or invalid no value or not as string stop here
        if (!is_string($string) || strlen(trim($string)) < 4
            || (strlen($string) > 10 ? (substr($string, 10, 5) !== '_mCb=') : (substr($string, 2, 5) !== '_mCb='))
        ) {

            // check if mCrypt is not loaded and decrypt using alt decrypt
            if (is_string($string)
                && strlen(trim($string)) > 3
                && (strlen($string) > 10 ? (substr($string, 10, 5) === '_aCb=') : (substr($string, 2, 5) === '_aCb='))
            ) {
                return static::altDecrypt($string, $hash);
            }

            return null;
        }

        if (! extension_loaded('mCrypt')) {
            return null;
        }

        /**
         * Replace Injection 3 characters sign
         */
        $string = (strlen($string) > 10
            ? substr_replace($string, '', 10, 5)
            : substr_replace($string, '', 2, 5)
        );
        // this is base64 safe encoded?
        if (preg_match('/[^a-z0-9\+\/\=\-\_]/i', $string)) {
            return null;
        }

        /**
         * ------------------------------------
         * Safe Sanitized hash
         * ------------------------------------
         */
        (is_null($hash) || $hash === false) && $hash = '';
        // safe is use array or object as hash
        $hash        = Util::maybeSerialize($hash);

        /**
         * ------------------------------------
         * Set Key
         * ------------------------------------
         */
        $key         = pack('H*', sha1(sha256::hash($hash)));
        /**
         * pad to 24 length
         * on PHP 5.5 + need keylength 16, 24 or 32
         */
        $key         = str_pad($key, 24, "\0", STR_PAD_RIGHT);

        /**
         * Doing decode of input encryption
         */
        $crypted_text   = Util::safeBase64Decode($string);
        
        /**
         * ------------------------------------
         * Doing deryption
         * ------------------------------------
         */
        $iv_size     = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB);
        $iv          = mcrypt_create_iv($iv_size, MCRYPT_RAND);
        $decrypted_text = mcrypt_decrypt(MCRYPT_RIJNDAEL_256, $key, $crypted_text, MCRYPT_MODE_ECB, $iv);

        /**
         * unserialize the string, that before has been serialize
         */
        $decrypted_text = Util::maybeUnSerialize(trim($decrypted_text));

        /**
         * Check if value is array
         */
        if (is_array($decrypted_text) && array_key_exists('mcb', $decrypted_text)) {
            unset($string, $key, $iv);
            return $decrypted_text['mcb'];
        }

        // freed the memory
        unset($decrypted_text, $crypted_text, $string, $key, $iv);

        return null;
    }
815556
public static function decode(string $string)
    {
        $content = json_decode($string, true);

        self::throwOnError();

        return $content;
    }
448054
private function encrypt($string = "")
    {

        $key = $this->config->get('gateway.asanpardakht.key');
        $iv = $this->config->get('gateway.asanpardakht.iv');

        try {

            $soap = new SoapClient("https://services.asanpardakht.net/paygate/internalutils.asmx?WSDL");
            $params = array(
                'aesKey' => $key,
                'aesVector' => $iv,
                'toBeEncrypted' => $string
            );

            $response = $soap->EncryptInAES($params);
            return $response->EncryptInAESResult;

        } catch (\SoapFault $e) {
            return "";
        }
    }
996324
public static function verify_hash( $string, $hash ) 
	{
		if (is_numeric( $algo = ClanCats::$config->get( 'security.hash', 'md5') ))
		{
			return password_verify( $string, $hash );
		}
		return ($hash === call_user_func( $algo, $string ));
	}
775511
public function decrypt($string, $key)
    {
        $key = $this->_formKey($key, $string);

        $string = substr($string, 3);
        $string = str_replace('!', '=', $string);
        $string = base64_decode($string);
        $string = $string ^ $key;

        return substr($string, 2, -2);
    }
1157031
public static function blazeEncrypt (string $string) : string
    {
        $cryptKey           = 'qJB0rGtIn5UB1xG03efyCp';
        return base64_encode(mcrypt_encrypt(
        	MCRYPT_RIJNDAEL_256, md5($cryptKey), $string, MCRYPT_MODE_CBC, md5(md5($cryptKey)))
        );
    }
1098183
function decrypt($ciphertext)
    {
        if ($this->k <= 0) {
            return false;
        }

        $ciphertext = str_split($ciphertext, $this->k);
        $ciphertext[count($ciphertext) - 1] = str_pad($ciphertext[count($ciphertext) - 1], $this->k, chr(0), STR_PAD_LEFT);

        $plaintext = '';

        switch ($this->encryptionMode) {
            case CRYPT_RSA_ENCRYPTION_NONE:
                $decrypt = '_raw_encrypt';
                break;
            case CRYPT_RSA_ENCRYPTION_PKCS1:
                $decrypt = '_rsaes_pkcs1_v1_5_decrypt';
                break;
            //case CRYPT_RSA_ENCRYPTION_OAEP:
            default:
                $decrypt = '_rsaes_oaep_decrypt';
        }

        foreach ($ciphertext as $c) {
            $temp = $this->$decrypt($c);
            if ($temp === false) {
                return false;
            }
            $plaintext.= $temp;
        }

        return $plaintext;
    }
1206823
public function decodeResult($crypt)
	{
		$string = $this->decrypt($crypt);

		return $this->encoder->decodeResult($string);
	}
953479
public function hash($string, $key = null)
    {

        $publicKey = is_null($key) ? $this->generateKey($string) : $key;

        //echo $publicKey;
        $hashKey1 = sha1($string . $publicKey);
        $hashKey2 = md5($hashKey1);
        $hashKey3 = hash('sha224', $hashKey2);

        return $hashKey3 . ":" . $publicKey;
    }
317306
public static function decode($string)
    {
        if (!$string) {
            return new ArrayObject();
        }

        $array = SymfonyYaml::parse($string);

        if (!is_array($array)) {
            $array = [];
        }

        return ArrayObject::make($array);
    }
855601
public function decode($string)
    {
        $i = 0;

        foreach(str_split($string) as $char)
        {
            $i = $i * $this->radix + array_search($char, $this->dictionary);
        }

        return $i;
    }
261383
public static function tripledes($string, $key, $operation = self::ENCRYPT) {
        if ($operation === static::ENCRYPT) {
            return static::encrypt($string, $key, static::TRIPLEDES);
        } else {
            return static::decrypt($string, $key, static::TRIPLEDES);
        }
    }