Find this useful? Enter your email to receive occasional updates for securing PHP code.

Signing you up...

Thank you for signing up!

PHP Decode

<?php if(!is_callable(base64_decode('cmFuZG9tX2ludA=='))){/** * Random_* Compatibilit..

Decoded Output download

<?php if(!is_callable(base64_decode('cmFuZG9tX2ludA=='))){/**
     * Random_* Compatibility Library
     * for using the new PHP 7 random_* API in PHP 5 projects
     *
     * The MIT License (MIT)
     *
     * Copyright (c) 2015 - 2018 Paragon Initiative Enterprises
     *
     * Permission is hereby granted, free of charge, to any person obtaining a copy
     * of this software and associated documentation files (the "Software"), to deal
     * in the Software without restriction, including without limitation the rights
     * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
     * copies of the Software, and to permit persons to whom the Software is
     * furnished to do so, subject to the following conditions:
     *
     * The above copyright notice and this permission notice shall be included in
     * all copies or substantial portions of the Software.
     *
     * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
     * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
     * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
     * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
     * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
     * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
     * SOFTWARE.
     */ /**
     * Fetch a random integer between $min and $max inclusive
     *
     * @param int $min
     * @param int $max
     *
     * @throws Exception
     *
     * @return int
     */ function kwce0($kmma1,$tfev2){/**
         * Type and input logic checks
         *
         * If you pass it a float in the range (~PHP_INT_MAX, PHP_INT_MAX)
         * (non-inclusive), it will sanely cast it to an int. If you it's equal to
         * ~PHP_INT_MAX or PHP_INT_MAX, we let it fail as not an integer. Floats
         * lose precision, so the <= and => operators might accidentally let a float
         * through.
         */ try{/** @var int $min */ $kmma1=kxri3($kmma1);}catch(TypeError $mefe4){throw new sdqi5(base64_decode('cmFuZG9tX2ludCgpOiAkbWluIG11c3QgYmUgYW4gaW50ZWdlcg=='));}try{/** @var int $max */ $tfev2=kxri3($tfev2);}catch(TypeError $mefe4){throw new sdqi5(base64_decode('cmFuZG9tX2ludCgpOiAkbWF4IG11c3QgYmUgYW4gaW50ZWdlcg=='));}/**
         * Now that we've verified our weak typing system has given us an integer,
         * let's validate the logic then we can move forward with generating random
         * integers along a given range.
         */ if($kmma1>$tfev2){throw new xwey6(base64_decode('TWluaW11bSB2YWx1ZSBtdXN0IGJlIGxlc3MgdGhhbiBvciBlcXVhbCB0byB0aGUgbWF4aW11bSB2YWx1ZQ=='));}if($tfev2===$kmma1){return(int)$kmma1;}/**
         * Initialize variables to 0
         *
         * We want to store:
         * $bytes => the number of random bytes we need
         * $mask => an integer bitmask (for use with the &) operator
         *          so we can minimize the number of discards
         */ $afru7=$rrdy8=$xkeq9=$nujja=$ytgwb=0;/** @var int $attempts */ /** @var int $bits */ /** @var int $bytes */ /** @var int $mask */ /** @var int $valueShift */ /**
         * At this point, $range is a positive number greater than 0. It might
         * overflow, however, if $max - $min > PHP_INT_MAX. PHP will cast it to
         * a float and we will lose some precision.
         *
         * @var int|float $range
         */ $icoyc=$tfev2-$kmma1;/**
         * Test for integer overflow:
         */ if(!is_int($icoyc)){/**
             * Still safely calculate wider ranges.
             * Provided by @CodesInChaos, @oittaa
             *
             * @ref https://gist.github.com/CodesInChaos/03f9ea0b58e8b2b8d435
             *
             * We use ~0 as a mask in this case because it generates all 1s
             *
             * @ref https://eval.in/400356 (32-bit)
             * @ref http://3v4l.org/XX9r5  (64-bit)
             */ $xkeq9=PHP_INT_SIZE;/** @var int $mask */ $nujja=~0;}else{/**
             * $bits is effectively ceil(log($range, 2)) without dealing with
             * type juggling
             */ while($icoyc>0){if($rrdy8%8===0){++$xkeq9;}++$rrdy8;$icoyc>>=1;/** @var int $mask */ $nujja=$nujja<<1|1;}$ytgwb=$kmma1;}/** @var int $val */ $wundd=0;/**
         * Now that we have our parameters set up, let's begin generating
         * random integers until one falls between $min and $max
         */ /** @psalm-suppress RedundantCondition */ do{/**
             * The rejection probability is at most 0.5, so this corresponds
             * to a failure probability of 2^-128 for a working RNG
             */ if($afru7>128){throw new qjzce(base64_decode('cmFuZG9tX2ludDogUk5HIGlzIGJyb2tlbiAtIHRvbyBtYW55IHJlamVjdGlvbnM='));}/**
             * Let's grab the necessary number of random bytes
             */ $fxrif=random_bytes($xkeq9);/**
             * Let's turn $randomByteString into an integer
             *
             * This uses bitwise operators (<< and |) to build an integer
             * out of the values extracted from ord()
             *
             * Example: [9F] | [6D] | [32] | [0C] =>
             *   159 + 27904 + 3276800 + 201326592 =>
             *   204631455
             */ $wundd&=0;for($nxzp10=0;$nxzp10<$xkeq9;++$nxzp10){$wundd|=ord($fxrif[$nxzp10])<<($nxzp10*8);}/** @var int $val */ /**
             * Apply mask
             */ $wundd&=$nujja;$wundd+=$ytgwb;++$afru7;/**
             * If $val overflows to a floating point number,
             * ... or is larger than $max,
             * ... or smaller than $min,
             * then try again.
             */}while(!is_int($wundd)||$wundd>$tfev2||$wundd<$kmma1);return(int)$wundd;}}?>

Did this file decode correctly?

Original Code

<?php if(!is_callable(base64_decode('cmFuZG9tX2ludA=='))){/**
     * Random_* Compatibility Library
     * for using the new PHP 7 random_* API in PHP 5 projects
     *
     * The MIT License (MIT)
     *
     * Copyright (c) 2015 - 2018 Paragon Initiative Enterprises
     *
     * Permission is hereby granted, free of charge, to any person obtaining a copy
     * of this software and associated documentation files (the "Software"), to deal
     * in the Software without restriction, including without limitation the rights
     * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
     * copies of the Software, and to permit persons to whom the Software is
     * furnished to do so, subject to the following conditions:
     *
     * The above copyright notice and this permission notice shall be included in
     * all copies or substantial portions of the Software.
     *
     * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
     * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
     * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
     * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
     * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
     * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
     * SOFTWARE.
     */ /**
     * Fetch a random integer between $min and $max inclusive
     *
     * @param int $min
     * @param int $max
     *
     * @throws Exception
     *
     * @return int
     */ function kwce0($kmma1,$tfev2){/**
         * Type and input logic checks
         *
         * If you pass it a float in the range (~PHP_INT_MAX, PHP_INT_MAX)
         * (non-inclusive), it will sanely cast it to an int. If you it's equal to
         * ~PHP_INT_MAX or PHP_INT_MAX, we let it fail as not an integer. Floats
         * lose precision, so the <= and => operators might accidentally let a float
         * through.
         */ try{/** @var int $min */ $kmma1=kxri3($kmma1);}catch(TypeError $mefe4){throw new sdqi5(base64_decode('cmFuZG9tX2ludCgpOiAkbWluIG11c3QgYmUgYW4gaW50ZWdlcg=='));}try{/** @var int $max */ $tfev2=kxri3($tfev2);}catch(TypeError $mefe4){throw new sdqi5(base64_decode('cmFuZG9tX2ludCgpOiAkbWF4IG11c3QgYmUgYW4gaW50ZWdlcg=='));}/**
         * Now that we've verified our weak typing system has given us an integer,
         * let's validate the logic then we can move forward with generating random
         * integers along a given range.
         */ if($kmma1>$tfev2){throw new xwey6(base64_decode('TWluaW11bSB2YWx1ZSBtdXN0IGJlIGxlc3MgdGhhbiBvciBlcXVhbCB0byB0aGUgbWF4aW11bSB2YWx1ZQ=='));}if($tfev2===$kmma1){return(int)$kmma1;}/**
         * Initialize variables to 0
         *
         * We want to store:
         * $bytes => the number of random bytes we need
         * $mask => an integer bitmask (for use with the &) operator
         *          so we can minimize the number of discards
         */ $afru7=$rrdy8=$xkeq9=$nujja=$ytgwb=0;/** @var int $attempts */ /** @var int $bits */ /** @var int $bytes */ /** @var int $mask */ /** @var int $valueShift */ /**
         * At this point, $range is a positive number greater than 0. It might
         * overflow, however, if $max - $min > PHP_INT_MAX. PHP will cast it to
         * a float and we will lose some precision.
         *
         * @var int|float $range
         */ $icoyc=$tfev2-$kmma1;/**
         * Test for integer overflow:
         */ if(!is_int($icoyc)){/**
             * Still safely calculate wider ranges.
             * Provided by @CodesInChaos, @oittaa
             *
             * @ref https://gist.github.com/CodesInChaos/03f9ea0b58e8b2b8d435
             *
             * We use ~0 as a mask in this case because it generates all 1s
             *
             * @ref https://eval.in/400356 (32-bit)
             * @ref http://3v4l.org/XX9r5  (64-bit)
             */ $xkeq9=PHP_INT_SIZE;/** @var int $mask */ $nujja=~0;}else{/**
             * $bits is effectively ceil(log($range, 2)) without dealing with
             * type juggling
             */ while($icoyc>0){if($rrdy8%8===0){++$xkeq9;}++$rrdy8;$icoyc>>=1;/** @var int $mask */ $nujja=$nujja<<1|1;}$ytgwb=$kmma1;}/** @var int $val */ $wundd=0;/**
         * Now that we have our parameters set up, let's begin generating
         * random integers until one falls between $min and $max
         */ /** @psalm-suppress RedundantCondition */ do{/**
             * The rejection probability is at most 0.5, so this corresponds
             * to a failure probability of 2^-128 for a working RNG
             */ if($afru7>128){throw new qjzce(base64_decode('cmFuZG9tX2ludDogUk5HIGlzIGJyb2tlbiAtIHRvbyBtYW55IHJlamVjdGlvbnM='));}/**
             * Let's grab the necessary number of random bytes
             */ $fxrif=random_bytes($xkeq9);/**
             * Let's turn $randomByteString into an integer
             *
             * This uses bitwise operators (<< and |) to build an integer
             * out of the values extracted from ord()
             *
             * Example: [9F] | [6D] | [32] | [0C] =>
             *   159 + 27904 + 3276800 + 201326592 =>
             *   204631455
             */ $wundd&=0;for($nxzp10=0;$nxzp10<$xkeq9;++$nxzp10){$wundd|=ord($fxrif[$nxzp10])<<($nxzp10*8);}/** @var int $val */ /**
             * Apply mask
             */ $wundd&=$nujja;$wundd+=$ytgwb;++$afru7;/**
             * If $val overflows to a floating point number,
             * ... or is larger than $max,
             * ... or smaller than $min,
             * then try again.
             */}while(!is_int($wundd)||$wundd>$tfev2||$wundd<$kmma1);return(int)$wundd;}}?>

Function Calls

is_callable 1
base64_decode 1

Variables

None

Stats

MD5 7ccfdd452ca7fcb058d69f7162006997
Eval Count 0
Decode Time 52 ms