@ 2015-12-14T15:46:37Z <?php
$data = "wpdPVWejqNRYqDTeUJ2Iw06/rnfHAoy5jtgTojiilD0=";
$pwd = "ICS2015";
$salt = "7";
$dec = Decrypt($data, $pwd, $salt);
echo "Dec: " . $dec . "\r\n";
$enc = Encrypt("boy10@naver.com", $pwd, $salt);
echo "Enc: " . $enc . "\r\n";
function Decrypt($ciphertext, $password, $salt)
{
$ciphertext = base64_decode($ciphertext);
$key = PBKDF1($password, $salt, 100, 32);
$iv = PBKDF1($password, $salt, 100, 16);
echo "bb" . base64_encode($iv);
// NB: Need 128 not 256 and CBC mode to be compatible
$decpad = mcrypt_decrypt(MCRYPT_RIJNDAEL_128, $key, $ciphertext, MCRYPT_MODE_CBC, $iv);
$pad = ord($decpad[($len = strlen($decpad)) - 1]);
$dec = substr($decpad, 0, strlen($decpad) - $pad);
return $dec;
}
function Encrypt($ciphertext, $password, $salt)
{
$key = PBKDF1($password, $salt, 100, 32);
$iv = PBKDF1($password, $salt, 100, 16);
echo "aa" . base64_encode($iv);
return base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_128, $key, $ciphertext, MCRYPT_MODE_CBC, $iv));
}
function PBKDF1($pass, $salt, $count, $cb)
{
static $base;
static $extra;
static $extracount= 0;
static $hashno;
static $state = 0;
if ($state == 0)
{
$hashno = 0;
$state = 1;
$key = $pass . $salt;
$base = sha1($key, true);
for($i = 2; $i < $count; $i++)
{
$base = sha1($base, true);
}
}
$result = "";
if ($extracount > 0)
{
$rlen = strlen($extra) - $extracount;
if ($rlen >= $cb)
{
$result = substr($extra, $extracount, $cb);
if ($rlen > $cb)
{
$extracount += $cb;
}
else
{
$extra = null;
$extracount = 0;
}
return $result;
}
$result = substr($extra, $rlen, $rlen);
}
$current = "";
$clen = 0;
$remain = $cb - strlen($result);
while ($remain > $clen)
{
if ($hashno == 0)
{
$current = sha1($base, true);
}
else if ($hashno < 1000)
{
$n = sprintf("%d", $hashno);
$tmp = $n . $base;
$current .= sha1($tmp, true);
}
$hashno++;
$clen = strlen($current);
}
// $current now holds at least as many bytes as we need
$result .= substr($current, 0, $remain);
// Save any left over bytes for any future requests
if ($clen > $remain)
{
$extra = $current;
$extracount = $remain;
}
return $result;
}
?>
Enable javascript to submit You have javascript disabled. You will not be able to edit any code.
Output for git.master , git.master_jit , rfc.property-hooks bbBWnvykvGs/KwmNm+QXcfEg==
Fatal error: Uncaught Error: Call to undefined function mcrypt_decrypt() in /in/sh70h:25
Stack trace:
#0 /in/sh70h(8): Decrypt('\xC2\x97OUg\xA3\xA8\xD4X\xA84\xDEP\x9D\x88...', 'ICS2015', '7')
#1 {main}
thrown in /in/sh70h on line 25
Process exited with code 255 . This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.
Active branches Archived branches Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page
preferences:dark mode live preview
55.86 ms | 401 KiB | 8 Q