- var_dump: documentation ( source)
- base64_decode: documentation ( source)
- str_repeat: documentation ( source)
- base64_encode: documentation ( source)
- strrev: documentation ( source)
<?php
/**
* It should go without saying that this is insecure.
*
* Don't use it!
*
* @ref http://www.cryptofails.com/post/87697461507/46esab-high-quality-cryptography-direct-from
*/
function encodeString($str){
for($i=0; $i<5;$i++)
{
$str=strrev(base64_encode($str)); // apply base64 first and then reverse the string
}
return $str;
}
function decodeString($str){
for($i=0; $i<5;$i++)
{
$str=base64_decode(strrev($str)); // apply base64 first and then reverse the string
}
return $str;
}
# ~8<~8<~8<~8<~8<~8<~8<~8<~8<~8<~8<~8<~8<~8<~8<~8<~8<~8<~8<~8<~8<~8<~ #
$a = array(
'a',
'aaa',
'aaaaaa',
str_repeat('a', 126),
str_repeat('a', 1024),
str_repeat('a', 2048)
);
$sizeOfA = count($a);
$length = array();
$encoded = array();
for ($i = 0; $i < $sizeOfA; ++$i) {
$encoded[$i] = encodeString($a[$i]);
$length[$i] = strlen($encoded[$i]);
}
var_dump($length);
var_dump($encoded);
This script was stopped while abusing our resources