3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $partner_key = 1; $string = 'test_string'; # --- ENCRYPTION --- # the key should be random binary, use scrypt, bcrypt or PBKDF2 to # convert a string into a key # key is specified using hexadecimal $key = pack('H*', bin2hex($partner_key)); # show key size use either 16, 24 or 32 byte keys for AES-128, 192 # and 256 respectively $key_size = strlen($key); # create a random IV to use with CBC encoding $iv_size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_CBC); $iv = mcrypt_create_iv($iv_size, MCRYPT_RAND); # creates a cipher text compatible with AES (Rijndael block size = 128) # to keep the text confidential # only suitable for encoded input that never ends with value 00h # (because of default zero padding) $ciphertext = mcrypt_encrypt(MCRYPT_RIJNDAEL_128, $key, $string, MCRYPT_MODE_CBC, $iv); # prepend the IV for it to be available for decryption $ciphertext = $iv . $ciphertext; # encode the resulting cipher text so it can be represented by a string $ciphertext_base64 = base64_encode($ciphertext); //echo $ciphertext_base64 . "\n"; echo $ciphertext_base64;
based on 62q4O
Output for 7.0.6 - 7.1.0
Fatal error: Uncaught Error: Call to undefined function mcrypt_get_iv_size() in /in/BEfeu:16 Stack trace: #0 {main} thrown in /in/BEfeu on line 16
Process exited with code 255.
Output for 7.0.5
Warning: mcrypt_encrypt(): Key of size 1 not supported by this algorithm. Only keys of sizes 16, 24 or 32 supported in /in/BEfeu on line 23 XTbF2rTpsmdaIZWrUGdAWA==
Output for 7.0.4
Warning: mcrypt_encrypt(): Key of size 1 not supported by this algorithm. Only keys of sizes 16, 24 or 32 supported in /in/BEfeu on line 23 ijeW7VstJHULBGjTHXVO2A==
Output for 7.0.3
Warning: mcrypt_encrypt(): Key of size 1 not supported by this algorithm. Only keys of sizes 16, 24 or 32 supported in /in/BEfeu on line 23 r/XmvILoLZkdFLePJtKEcA==
Output for 7.0.2
Warning: mcrypt_encrypt(): Key of size 1 not supported by this algorithm. Only keys of sizes 16, 24 or 32 supported in /in/BEfeu on line 23 +qXcTWqwPDiC7f69bAOGUA==
Output for 7.0.1
Warning: mcrypt_encrypt(): Key of size 1 not supported by this algorithm. Only keys of sizes 16, 24 or 32 supported in /in/BEfeu on line 23 ykd9OIRadtHCgCeX9mDX1Q==
Output for 7.0.0
Warning: mcrypt_encrypt(): Key of size 1 not supported by this algorithm. Only keys of sizes 16, 24 or 32 supported in /in/BEfeu on line 23 pC6mtsCHAQ6Qf/3aAtuezQ==
Output for hhvm-3.12.0
XDYl84PFXYfFBfFN9KpJ3/2nXQkpiV+KhD+M7MbIXFo=
Output for hhvm-3.10.0
ERKy4wdme+lnPG21xDlQyT3R1QlKsp+mZyRo1g5HjWE=
Output for 5.0.0 - 5.3.29, 5.5.35, 5.6.21 - 5.6.28
Fatal error: Call to undefined function mcrypt_get_iv_size() in /in/BEfeu on line 16
Process exited with code 255.
Output for 5.6.20
Warning: mcrypt_encrypt(): Key of size 1 not supported by this algorithm. Only keys of sizes 16, 24 or 32 supported in /in/BEfeu on line 23 QjAREzscATWTMU+uCk55Ig==
Output for 5.6.19
Warning: mcrypt_encrypt(): Key of size 1 not supported by this algorithm. Only keys of sizes 16, 24 or 32 supported in /in/BEfeu on line 23 tZCQxjyWPg/gSTOgkScwug==
Output for 5.6.18
Warning: mcrypt_encrypt(): Key of size 1 not supported by this algorithm. Only keys of sizes 16, 24 or 32 supported in /in/BEfeu on line 23 0GTHTQ3qCP4q9nrP8GCTTg==
Output for 5.6.17
Warning: mcrypt_encrypt(): Key of size 1 not supported by this algorithm. Only keys of sizes 16, 24 or 32 supported in /in/BEfeu on line 23 0SdTJqa71yAzc8qcoUcD/Q==
Output for 5.6.16
Warning: mcrypt_encrypt(): Key of size 1 not supported by this algorithm. Only keys of sizes 16, 24 or 32 supported in /in/BEfeu on line 23 3tF2c0GsyrhTaOwmqIgFow==
Output for 5.6.15
Warning: mcrypt_encrypt(): Key of size 1 not supported by this algorithm. Only keys of sizes 16, 24 or 32 supported in /in/BEfeu on line 23 7eEye5gvb8Smc4u+5R67+Q==
Output for 5.6.14
Warning: mcrypt_encrypt(): Key of size 1 not supported by this algorithm. Only keys of sizes 16, 24 or 32 supported in /in/BEfeu on line 23 Iwev5sdGoNJ1hfXI6qfrvA==
Output for 5.6.13
Warning: mcrypt_encrypt(): Key of size 1 not supported by this algorithm. Only keys of sizes 16, 24 or 32 supported in /in/BEfeu on line 23 zGRvg5GcU2Q2UhEXV94VTA==
Output for 5.6.12
Warning: mcrypt_encrypt(): Key of size 1 not supported by this algorithm. Only keys of sizes 16, 24 or 32 supported in /in/BEfeu on line 23 sWfcJ++CzSGjZlodz7N25A==
Output for 5.6.11
Warning: mcrypt_encrypt(): Key of size 1 not supported by this algorithm. Only keys of sizes 16, 24 or 32 supported in /in/BEfeu on line 23 Z+WujKl0wcu3keEGFuLCjw==
Output for 5.6.10
Warning: mcrypt_encrypt(): Key of size 1 not supported by this algorithm. Only keys of sizes 16, 24 or 32 supported in /in/BEfeu on line 23 5qpMf8/s+SGI3iRcc8l6kg==
Output for 5.6.9
Warning: mcrypt_encrypt(): Key of size 1 not supported by this algorithm. Only keys of sizes 16, 24 or 32 supported in /in/BEfeu on line 23 Pr3UpxEKai2holu/XzK41g==
Output for 5.6.8
Warning: mcrypt_encrypt(): Key of size 1 not supported by this algorithm. Only keys of sizes 16, 24 or 32 supported in /in/BEfeu on line 23 4o5rm5A+WwXkGuxjk7ZKuw==
Output for 5.6.7
Warning: mcrypt_encrypt(): Key of size 1 not supported by this algorithm. Only keys of sizes 16, 24 or 32 supported in /in/BEfeu on line 23 smkM8bxaPgX2rKyqlxvazQ==
Output for 5.5.34
rWJDEI7coHVHF2pKMZ+oPLyPF3pVDWbe0NfxvAdqjZ4=
Output for 5.5.33
2dhG/CH+embElktf1xdtx7iEPHUDBGPqC5QfiP5RfxM=
Output for 5.5.32
dK3OmsRjsl3UI6Ci6X05keOGlsVY6LPOC2mRnjvE7L0=
Output for 5.5.31
bKzbcxhkrqqY+aWUKLXD4gNwr5LSi5gKddO4bIt7eY8=
Output for 5.5.30
nu9BMbGYIPCv242rFzTKktuTCNYbtE6x7Sbnw1QGnTY=
Output for 5.5.29
No5kHpRzsosOrijJnkC2GVkVVVPABCwhFOH0rbP3AHY=
Output for 5.5.28
VNx72GcCSuSeRuQDDR+IBVRIqrz+L9E9srgfEL09zgQ=
Output for 5.5.27
ubFr1YcwRXrZjFhc49+0qQb435D+k2S+zhsb/xO8RT8=
Output for 5.5.26
/TroAvEzsI+cZdy2J31xiMe5YzF7hvUK96Yd5njQZ6Q=
Output for 5.5.25
jGkHxynP19Gatbb93HAOLRrnb0WMV1dk55VP0GOyh68=
Output for 5.5.24
GOCwV6gxpOEK8266nlUhnytokvv1EA5+pBacKz9rHOk=
Output for 5.4.45
lveeP0cmiLav+wrq+PtfNApQGBLvmg0IQ1H1b4XvtsU=
Output for 5.4.44
/S+jraFUa1/GvPnaw/16FuzWwNxqm/7WFBSM4oElmiQ=
Output for 5.4.43
1jh1oUqu9+0gaXHO/WcZ92Bxqm2mYXZI7AuiYOTvWxw=
Output for 5.4.42
slPGwIVb7gUT6ARbVd5OU5oSJpfEH6OZ2gzEm6b+0pQ=
Output for 5.4.41
P4z0DRT7RYhRB4oUiggJg/uduJwvX5fVmbdFKI3Ko7w=
Output for 5.4.40
Dj/j9Q2I1jXEdpZ+QQSj1leucmiV3qmheZMZiSLyFzw=
Output for 5.4.39
dvdF5iXxVOBpp/c1lKiyQ3fIV5SZa2mDcoh1qxa76po=
Output for 5.4.38
Qx8/fjhdrwDqHHAfx6u7N79CXIuiBe+8Q2YqBQe8OSM=
Output for 5.4.37
Tc9ntWnFOOpTb9gsF1i0PyXlhMXw8ysmAtVZaOfGwZ0=
Output for 5.4.36
WSD1FQi0iUVnIKIXFLPnKCj2uPWE2f6UqnMI+QKog0A=
Output for 5.4.35
UvPO2I9vuFp1xzful2/5lDzDuPqlnhfYhppX7BmuNkY=
Output for 5.4.34
DKgmn5J9vf1d4PQ3IY0FQCc8wp8AvwDnbDN3991hefQ=
Output for 5.4.32
P/B1h9Y3vuVoU2O6ls5ldWTDK8YHZtz/G1FBSEYpnLM=
Output for 5.4.31
KZsiglxk7OdCmUAgY8jnwD9np+sibenfBud+fBbDKJY=
Output for 5.4.30
Mpk4yuLw26rta2mfpDs32MffQck/P64Le2c1t12XSMo=
Output for 5.4.29
8gCa5m+QUnYWA19k5nJPJ7GJUjCK8Uc4cnbjdyXjL68=
Output for 5.4.28
kdlpV0hPuXbzZFq/34fYw7nIVIE8JKw1EDWWD931j60=
Output for 5.4.27
gTgm8bCOql8Edja0Sf0FTWyjLmgncNSGk3Mt+T61M7s=
Output for 5.4.26
4OxunUavL+K65DARCfOdRXDMYs1B+DW2RazdpEjxpsQ=
Output for 5.4.25
7zDPLzZId9bdVNpedWyjwzPifYlVcVODJoUuD7F9bHk=
Output for 5.4.24
jtipZHp2V35mK1IL4hTZj8I7ylNKXETJM+r4TX70TS8=
Output for 5.4.23
Lui+HDl+wr+Tf16NamusoB9+AiW0Q4dZvb4sDRq/cZI=
Output for 5.4.22
kzocveqEUVVbZBuZzwBP5WBzJS6oEsjr7w1m35NVB9E=
Output for 5.4.21
Im+oQahUQTunLITQlf5v+8+Xf2tASpzvJe/lwwVcU1I=
Output for 5.4.20
328kmNq0g6UTnzdUvlvqWJ+jGGUPYPuivwk8aAl933w=
Output for 5.4.19
B7PJ0oO5ZFtXmzbvh7odEYy6YqElVjC8J01qItTjLl8=
Output for 5.4.18
c4xYvKjveVDV838C081UQ29PVVXFoWo4NY+2ED/7U2k=
Output for 5.4.17
KBoBwUc5Fu+dA0mk2giUwBqg3U7TW9uu8v+rOxyafoo=
Output for 5.4.16
JO749xTBIiUkKygZ0WNNz6N2aF303HTGe2RK9BNpjC4=
Output for 5.4.15
ZRYVgsAcaYUTlfM5Na8j3r1LDNhv/eeq/KjcgEsmLo4=
Output for 5.4.14
d/YqT8/M5saU2DkN8qx5eOb6GdszTrjSjg62meA6zoo=
Output for 5.4.13
upjgX1gEAiMBMoYkW8GjqlsFCzLaKrUP0wEZDk/qSGo=
Output for 5.4.12
JjvRfteIjA5GzAoi41Pd1aQWeeuOV+LXqro+hmQEXIU=
Output for 5.4.11
5lib3qg9A8d35AIj9Z6GkbdlAkFoYAAyVrL/17JXJOA=
Output for 5.4.10
3PTtYdNXXEwHIlAi0ylbFwpVd3n9biO9Z82XSFX6w90=
Output for 5.4.9
mkNjQRPyvPApNTtDh9DCah176uzrJVbKCjuuCAF9NC0=
Output for 5.4.8
kFddEnsYywBCHF/leQhW/NEYabYz8NyEqXZnaFNIrLU=
Output for 5.4.7
7yLRVyjgATpv30SyJiQUb8DEaqvKvkRrI/nhv7InoXU=
Output for 5.4.6
J4SISM/h0y6K8MTsopqjGp9Z5lg8Z1RsLtkjeaWtXA0=
Output for 5.4.5
fhvHQaB+8jM5wx/usjWgIrVr1EM2goTMwI1EzVry+uU=
Output for 5.4.4
7hmHlq+jZ4pF9NXv94atxOk4RrRhjD6qTUBo2qfvD+I=
Output for 5.4.3
8j/1VyRLtczKKsXZIivyo3tUxLNAUnOP/ad3r68dLnk=
Output for 5.4.2
wDT9gM1JmTq9xgMUSFuQYEGLNdQvQP1ko6G7UWk74rk=
Output for 5.4.1
OBBN1mRyfIMFmLbQamFNn+d+bDqK3OvF1F9onV1qp5I=
Output for 5.4.0
Eo/7x850dTPJAQByNBzv3tr5+eM6HUz8+0xSrFV2F0s=
Output for 4.4.5 - 4.4.9
Fatal error: Call to undefined function: mcrypt_get_iv_size() in /in/BEfeu on line 16
Process exited with code 255.
Output for 4.3.2 - 4.4.4
Fatal error: Call to undefined function: mcrypt_get_iv_size() in /in/BEfeu on line 16
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Call to undefined function: mcrypt_get_iv_size() in /in/BEfeu on line 16