!C99Shell v. 2.1 [PHP 8 Update] [02.02.2022]!

Software: Apache/2.4.53 (Unix) OpenSSL/1.1.1o PHP/7.4.29 mod_perl/2.0.12 Perl/v5.34.1. PHP/7.4.29 

uname -a: Linux vps-2738122-x 4.15.0-213-generic #224-Ubuntu SMP Mon Jun 19 13:30:12 UTC 2023 x86_64 

uid=1(daemon) gid=1(daemon) grupos=1(daemon) 

Safe-mode: OFF (not secure)

/opt/lampp/lib/php/test/Crypt_Xtea/   drwxr-xr-x
Free 13.54 GB of 61.93 GB (21.87%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Feedback    Self remove    Logout    


Viewing file:     XteaTest.php (9.59 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
//
// +----------------------------------------------------------------------+
// | PHP version 4.0                                                      |
// +----------------------------------------------------------------------+
// | Copyright (c) 2002-2004 The PHP Group                                |
// +----------------------------------------------------------------------+
// | This source file is subject to version 2.02 of the PHP license,      |
// | that is bundled with this package in the file LICENSE, and is        |
// | available at through the world-wide-web at                           |
// | http://www.php.net/license/2_02.txt.                                 |
// | If you did not receive a copy of the PHP license and are unable to   |
// | obtain it through the world-wide-web, please send a note to          |
// | license@php.net so we can mail you a copy immediately.               |
// +----------------------------------------------------------------------+
// | Authors: Jeroen Derks <jeroen@derks.it>                              |
// +----------------------------------------------------------------------+
//
// $Id: XteaTest.php,v 1.12 2004/10/04 19:51:56 jeroend Exp $

/** Xtea class */
require_once 'Crypt/Xtea.php';
/** PHPUnit class */
require_once 'PHPUnit.php';


/**
 *  Tester class for Xtea class.
 *  Tester class for Xtea class.
 *
 *  @package    Crypt_Xtea_Test
 *  @access     public
 *
 *  @version    $Revision: 1.12 $
 *  @since      2002/Aug/28
 *  @author     Jeroen Derks <jeroen@derks.it>
 */
class Crypt_XteaTest extends PHPUnit_TestCase
{
    var 
$obj;
    var 
$data;
    var 
$key;

    function 
Crypt_XteaTest($method) {
        global 
$profiling;

        
$this->profiling $profiling;
        
$this->PHPUnit_TestCase($method);
    }

    function 
setUp() {
        
$this->obj = new Crypt_Xtea();
        
$this->key '0123456789abcdeffedcba9876543210';

        if (!
$this->profiling$this->startTimer('data');
        
//$this->data = '1'; return;
        //$this->data = '01234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; return;
        
$this->data '';
        for (
$i 0$i 256; ++$i) {
            
$this->data .= chr($i 0xff);
        }
        if (!
$this->profiling$this->endTimer('data');
    }

    function 
testIter() {
        
$this->obj->setIter(36);
        
$this->assertEquals(36$this->obj->getIter());
    }

    function 
testCrypt() {
        
$start = IsSet($this->profiling) && $this->profiling strlen($this->data) - 0;
        if (
== $start) {
            
$walker '-\|/';
            echo 
"Testing... ";
            
flush();
        }

        for (
$i $start$i strlen($this->data); ++$i)
        {
            if (
== $start) {
                echo 
$walker{$i 4} . sprintf(" %4u"$i) . str_repeat(""6);
                
flush();
            }

            if (!
$this->profiling$this->startTimer('data');
            
$data substr($this->data0$i);
            if (!
$this->profiling$this->endTimer('data');

            if (!
$this->profiling$this->startTimer('encrypt');
            
$encrypted  $this->obj->encrypt($data$this->key);
            if (!
$this->profiling$this->endTimer('encrypt');
            if (!
$this->profiling$this->startTimer('decrypt');
            
$decrypted  $this->obj->decrypt($encrypted$this->key);
            if (!
$this->profiling$this->endTimer('decrypt');

            if (!
$this->profiling$this->startTimer('assert');
            
$this->assertEquals(strlen($data), strlen($decrypted));
            
$this->assertEquals($data$decrypted"run $i failed: expected '***' (".strlen($data)."), actual '***' (".strlen($decrypted).")");
            if (!
$this->profiling$this->endTimer('assert');
        }

        if (
== $start) {
            echo 
"                          ";
            
flush();
        }
    }

    function 
_testHuge() {
        
set_time_limit(99999);

        if (!
$this->profiling$this->startTimer('data');
        
$data '';
        for(
$i 0$i 1024 1024; ++$i)
            
$data .= chr($i 0xff);
        if (!
$this->profiling$this->endTimer('data');

        if (!
$this->profiling$this->startTimer('encrypt');
        
$encrypted $this->obj->encrypt($data$this->key);
        if (!
$this->profiling$this->endTimer('encrypt');
        if (!
$this->profiling$this->startTimer('decrypt');
        
$decrypted $this->obj->decrypt($encrypted$this->key);
        if (!
$this->profiling$this->endTimer('decrypt');

        if (!
$this->profiling$this->startTimer('assert');
        
$this->assertEquals(strlen($data), strlen($decrypted));
        
$this->assertEquals($data$decrypted"run $i failed: expected '***' (".strlen($data)."), actual '***' (".strlen($decrypted).")");
        if (!
$this->profiling$this->endTimer('assert');
    }

    function 
testCipher() {
        if (!
$this->profiling$this->startTimer('data');
        
$v = array(0x10x61000000);
        
$v = array(0x123456780xffffffff);
        
$w = array(00);
        
$k = array(0x012345670x89abcdef0x012345670x89abcdef);
        if (!
$this->profiling$this->endTimer('data');

        
printf("original:\n");
        
printf("v[0] = %10lu (0x%8lx)\n"$v[0], $v[0]);
        
printf("v[1] = %10lu (0x%8lx)\n"$v[1], $v[1]);

        if (!
$this->profiling$this->startTimer('encipher');
        
$this->obj->_encipherLong($v[0], $v[1], $w$k);
        if (!
$this->profiling$this->endTimer('encipher');

        
printf("encrypted:\n");
        
printf("w[0] = %10lu (0x%8lx)\n"$w[0], $w[0]);
        
printf("w[1] = %10lu (0x%8lx)\n"$w[1], $w[1]);

        if (!
$this->profiling$this->startTimer('decipher');
        
$this->obj->_decipherLong($w[0], $w[1], $r$k);
        if (!
$this->profiling$this->endTimer('decipher');

        
printf("decrypted:\n");
        
printf("v[0] = %10lu (0x%8lx)\n"$r[0], $r[0]);
        
printf("v[1] = %10lu (0x%8lx)\n"$r[1], $r[1]);

        if (!
$this->profiling$this->startTimer('assert');
        
$this->assertEquals((int) $v[0], $r[0], sprintf("$v[0] (%lu = 0x%lx) != $r[0] (%lu = 0x%lx)"$v[0], $v[0], $r[0], $r[0]));
        
$this->assertEquals((int) $v[1], $r[1], sprintf("$v[1] (%lu = 0x%lx) != $r[1] (%lu = 0x%lx)"$v[1], $v[1], $r[1], $r[1]));
        if (!
$this->profiling$this->endTimer('assert');
    }

    function 
testShift() {
        
$x = -12345678;
        
$n 2;
        
$y $this->obj->_rshift($x$n);
        
$z $x << $n;
        
$this->assertEquals((int) 0x3fd0e7ac$y"$x >> $n");
        
$this->assertEquals((int) 0xfd0e7ac8$z"$x << $n");

        
$x 0xffffffff;
        
$n 5;
        
$y $this->obj->_rshift($x$n);
        
$z $x << $n;
        
$this->assertEquals((int) 0x7ffffff$y"$x >> $n");
        
$this->assertEquals((int) 0xffffffe0$z"$x << $n");

        
$x 0x90000000;
        
$n 2;
        
$y $this->obj->_rshift($x$n);
        
$z $x << $n;
        
$this->assertEquals((int) 0x24000000$y"$x >> $n");
        
$this->assertEquals((int) 0x40000000$z"$x << $n");
    }

    function 
testAdd() {
        
$result $this->obj->_add(-0x123456780xfffffffe0x800000000xfedcba980xabcdef01);
        
$this->assertEquals((int) 0x1876531f$result'_add(-0x12345678, 0xfffffffe, 0x80000000, 0xfedcba98, 0xabcdef01)');
    }

    function 
tearDown() {
        
$this->obj NULL;
    }

    function 
startTimer($label) {
        
$time0 strtok(microtime(), ' ');
        
$time1 strtok(' ');

        
$timer              =& $this->_getTimer();
        
$timer[$label][]    = (string) $time1 substr($time01);
    }

    function 
endTimer($label) {
        
$time0 strtok(microtime(), ' ');
        
$time1 strtok(' ');

        
$timer              =& $this->_getTimer();
        
$timer[$label][]    = (string) $time1 substr($time01);
    }

    
/**
     *  @static
     */
    
function &_getTimer() {
        static 
$timing NULL;

        if (!IsSet(
$timing))
        {
            
$time0 strtok(microtime(), ' ');
            
$time1 strtok(' ');

            
// start _global
            
$timing = array('_global' => array((string) $time1 substr($time01)));
        }

        return 
$timing;
    }

    
/**
     *  @static
     */
    
function getTimings() {
        
$time0 strtok(microtime(), ' ');
        
$time1 strtok(' ');

        
$timer                  =& Crypt_XteaTest::_getTimer();
        
$timer['_global'][1]    = (string) $time1 substr($time01);
        
$labels                 =  array_keys($timer);
        
$results                =  array();

        
// calculate times and calls
        
sort($labels);
        foreach (
$labels as $label) {
            
$results[$label]['time']    = 0.0;
            
$results[$label]['calls']   = 0;

            
$n count($timer[$label]);
            for (
$i 0$i $n$i += 2) {
                
$results[$label]['time'] += (float) $timer[$label][$i 1] - $timer[$label][$i];
                ++
$results[$label]['calls'];
            }
        }

        
// calculate percentages
        
foreach ($labels as $label) {
            
$results[$label]['perc'] = ( $results[$label]['time'] * 100.0 ) / $results['_global']['time'];
        }

        
// output results
        
echo "Timing results:\n" .
            
sprintf("%-20s %13s %8s %10s%%\n"'Label''time''#calls''perc') .
            
str_repeat('-'57) . "\n";
        foreach (
$labels as $label) {
            
printf("%-20s %13s %8lu %10s%%\n",
                    
$label,
                    
sprintf("%.8f"$results[$label]['time']),
                    
$results[$label]['calls'],
                    
sprintf("%.6f"$results[$label]['perc']));
        }
    }
}

?>

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ Read-Only ]

:: Make Dir ::
 
[ Read-Only ]
:: Make File ::
 
[ Read-Only ]

:: Go Dir ::
 
:: Go File ::
 

--[ c99shell v. 2.1 [PHP 8 Update] [02.02.2022] maintained byC99Shell Github | Generation time: 0.4833 ]--