3v4l.org

run code in 300+ PHP versions simultaneously
<?php $plainText = "5546379527519027"; $blocksize = mcrypt_get_block_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_ECB); //$pad = $blocksize - (strlen($plainText) % $blocksize); //$padded = $plainText . str_repeat(chr($pad), $pad); $padded = pkcs5_pad($plainText); $secretKeyArray = array(112, 71, 32, -101, 42, 43, -6, 103, 113, -111, -39, -64, 40, -29, 31, 19); $key = ''; foreach($secretKeyArray as $k => $v) { $key.= chr($v & 0xFF); // trim to 8 bits (for the negative values) } $x=unpack('H*',$key); var_dump($x); $k="7047209b2a2bfa677191d9c028e31f13"; //$k="252A22C9D9C5FE43D954B91A989293ED"; $key=pack('H*',$k); $code = base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_128, $key, $padded, MCRYPT_MODE_ECB)); echo "$code"; /*252A22C9D9C5FE43D954B91A989293ED*/

preferences:
43.87 ms | 402 KiB | 5 Q