1. Go to this page and download the library: Download oasis/utils library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
use Oasis\Mlib\Utils\DataPacker;
$obj = new stdClass();
$tmpfile = tempnam(sys_get_temp_dir(), '');
$packer = new DataPacker();
$fh = fopen($tmpfile, 'w');
$packer->attachStream($fh);
$packer->packToStream($obj);
$packer->packToStream($obj);
$packer->packToStream($obj);
fclose($fh);
$fh = fopen($tmpfile, 'r');
$packer->attachStream($fh);
while ($obj = $packer->unpackFromStream()) {
// we should have 3 $obj unpacked from stream
}
use Oasis\Mlib\Utils\CaesarCipher;
$cipher = new CaesarCipher();
// encrypt and decrypt integer
$enc = $cipher->encrypt(1234);
$dec = $cipher->decrypt($enc); // $dec = 1234
// encrypt and decrypt string
$enc = $cipher->encrypt("abcdefg");
$dec = $cipher->decrypt($enc); // $dec = "abcdefg"
// using stronger cipher
$cipher = new CaesarCipher(
32, // bits to use in partition, default to 32, must be divisable by partition size
8, // partition size, even positive number, default to 8
12 // strength, positive number, default to 5
);
use Oasis\Mlib\Utils\Rc4;
$encrypted = Rc4::rc4('random-key', 'abc');
// to decrypt, call the encrypt function with same key
$decrypted = Rc4::rc4('random-key', $encrypted); // $decrypted = 'abc'
use Oasis\Mlib\Utils\CommonUtils;
// check the current memory usage and increase if needed
CommonUtils::monitorMemoryUsage();
// if the script declares tick, this will monitor memory usage every time tick is triggered
CommonUtils::registerMemoryMonitorForTick();
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.