3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class CRYPT { public function encrypt($Str,$Key=ENCKEY) { srand(); $Str=str_pad($Str, 32-strlen($Str)); $IVSize=mcrypt_get_iv_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_CBC); $IV=mcrypt_create_iv($IVSize, MCRYPT_RAND); $CryptStr=mcrypt_encrypt(MCRYPT_RIJNDAEL_128, $Key, $Str, MCRYPT_MODE_CBC, $IV); return base64_encode($IV.$CryptStr); } public function decrypt($CryptStr,$Key=ENCKEY) { if ($CryptStr!='') { $IV=substr(base64_decode($CryptStr),0,16); $CryptStr=substr(base64_decode($CryptStr),16); return trim(mcrypt_decrypt(MCRYPT_RIJNDAEL_128, $Key, $CryptStr, MCRYPT_MODE_CBC,$IV)); } else { return ''; } } } // class ENCRYPT() $enc = new CRYPT; $s = "test"; //$s = "FGykgbMFQiTpVIRhO9HWL/wXYevfsd7ozE99pbDWge/2Fs8fQb1iqeaw3yAe+kLsmTgPUz7mo/sTfEsvEfldWEx9XU51gsM6T1othRV6rshB9ThE3BOOUKKnhqt/gYyUP6POu5HSr7Rem7TIJIEAPh4w1cTQNN2ZCXyYS4Y+C/8="; $test = $enc->encrypt($s, "w+2#)1FP&LIPTL2<8I2"); echo $test; echo $enc->decrypt("4OkyDTPIuCi3PcQr5xwrkhWYHDu3J8loHA/D12BwVNTRk+gziMZYbCNCcIO0du92", "w+2#)1FP&LIPTL2<8I2");
based on KHqWL
Output for 7.0.6 - 7.2.0
Fatal error: Uncaught Error: Call to undefined function mcrypt_get_iv_size() in /in/VHfHY:7 Stack trace: #0 /in/VHfHY(28): CRYPT->encrypt('test ...', 'w+2#)1FP&LIPTL2...') #1 {main} thrown in /in/VHfHY on line 7
Process exited with code 255.
Output for 7.0.5
Warning: mcrypt_encrypt(): Key of size 19 not supported by this algorithm. Only keys of sizes 16, 24 or 32 supported in /in/VHfHY on line 9 FwlrYUQwlWDdBras8WsxCw== Warning: mcrypt_decrypt(): Key of size 19 not supported by this algorithm. Only keys of sizes 16, 24 or 32 supported in /in/VHfHY on line 17
Output for 7.0.4
Warning: mcrypt_encrypt(): Key of size 19 not supported by this algorithm. Only keys of sizes 16, 24 or 32 supported in /in/VHfHY on line 9 ScgP6jeHX7EArZWURN0WhA== Warning: mcrypt_decrypt(): Key of size 19 not supported by this algorithm. Only keys of sizes 16, 24 or 32 supported in /in/VHfHY on line 17
Output for 7.0.3
Warning: mcrypt_encrypt(): Key of size 19 not supported by this algorithm. Only keys of sizes 16, 24 or 32 supported in /in/VHfHY on line 9 eBSysG948bOv8tGTIsJdnw== Warning: mcrypt_decrypt(): Key of size 19 not supported by this algorithm. Only keys of sizes 16, 24 or 32 supported in /in/VHfHY on line 17
Output for 7.0.2
Warning: mcrypt_encrypt(): Key of size 19 not supported by this algorithm. Only keys of sizes 16, 24 or 32 supported in /in/VHfHY on line 9 rmB5PHbMYKno2B4xXufg6g== Warning: mcrypt_decrypt(): Key of size 19 not supported by this algorithm. Only keys of sizes 16, 24 or 32 supported in /in/VHfHY on line 17
Output for 7.0.1
Warning: mcrypt_encrypt(): Key of size 19 not supported by this algorithm. Only keys of sizes 16, 24 or 32 supported in /in/VHfHY on line 9 hQoSbZbhdcEuA0SfAisEOQ== Warning: mcrypt_decrypt(): Key of size 19 not supported by this algorithm. Only keys of sizes 16, 24 or 32 supported in /in/VHfHY on line 17
Output for 7.0.0
Warning: mcrypt_encrypt(): Key of size 19 not supported by this algorithm. Only keys of sizes 16, 24 or 32 supported in /in/VHfHY on line 9 N+5rsHHnHoXykLxaEL1euw== Warning: mcrypt_decrypt(): Key of size 19 not supported by this algorithm. Only keys of sizes 16, 24 or 32 supported in /in/VHfHY on line 17
Output for 5.3.19 - 5.3.29, 5.5.35, 5.6.21 - 5.6.28
Fatal error: Call to undefined function mcrypt_get_iv_size() in /in/VHfHY on line 7
Process exited with code 255.
Output for 5.6.20
Warning: mcrypt_encrypt(): Key of size 19 not supported by this algorithm. Only keys of sizes 16, 24 or 32 supported in /in/VHfHY on line 9 DDN4ZwrZqtktX9Czqq0zwA== Warning: mcrypt_decrypt(): Key of size 19 not supported by this algorithm. Only keys of sizes 16, 24 or 32 supported in /in/VHfHY on line 17
Output for 5.6.19
Warning: mcrypt_encrypt(): Key of size 19 not supported by this algorithm. Only keys of sizes 16, 24 or 32 supported in /in/VHfHY on line 9 VcCiuIDpDT83Fmz2zd8TDA== Warning: mcrypt_decrypt(): Key of size 19 not supported by this algorithm. Only keys of sizes 16, 24 or 32 supported in /in/VHfHY on line 17
Output for 5.6.18
Warning: mcrypt_encrypt(): Key of size 19 not supported by this algorithm. Only keys of sizes 16, 24 or 32 supported in /in/VHfHY on line 9 K9yMOFDHrgq1N9tLLU7ilA== Warning: mcrypt_decrypt(): Key of size 19 not supported by this algorithm. Only keys of sizes 16, 24 or 32 supported in /in/VHfHY on line 17
Output for 5.6.17
Warning: mcrypt_encrypt(): Key of size 19 not supported by this algorithm. Only keys of sizes 16, 24 or 32 supported in /in/VHfHY on line 9 0n+WFzJsqFahApscmyBzyQ== Warning: mcrypt_decrypt(): Key of size 19 not supported by this algorithm. Only keys of sizes 16, 24 or 32 supported in /in/VHfHY on line 17
Output for 5.6.16
Warning: mcrypt_encrypt(): Key of size 19 not supported by this algorithm. Only keys of sizes 16, 24 or 32 supported in /in/VHfHY on line 9 o/I6EdM/gvrApFkPBjcNGw== Warning: mcrypt_decrypt(): Key of size 19 not supported by this algorithm. Only keys of sizes 16, 24 or 32 supported in /in/VHfHY on line 17
Output for 5.6.15
Warning: mcrypt_encrypt(): Key of size 19 not supported by this algorithm. Only keys of sizes 16, 24 or 32 supported in /in/VHfHY on line 9 YQvrS7qALHgSUmODocYb7w== Warning: mcrypt_decrypt(): Key of size 19 not supported by this algorithm. Only keys of sizes 16, 24 or 32 supported in /in/VHfHY on line 17
Output for 5.6.14
Warning: mcrypt_encrypt(): Key of size 19 not supported by this algorithm. Only keys of sizes 16, 24 or 32 supported in /in/VHfHY on line 9 sgKNucdU8ij3zjy/pFa3Ag== Warning: mcrypt_decrypt(): Key of size 19 not supported by this algorithm. Only keys of sizes 16, 24 or 32 supported in /in/VHfHY on line 17
Output for 5.6.13
Warning: mcrypt_encrypt(): Key of size 19 not supported by this algorithm. Only keys of sizes 16, 24 or 32 supported in /in/VHfHY on line 9 hErWxwEB9bieMhJih/11Ag== Warning: mcrypt_decrypt(): Key of size 19 not supported by this algorithm. Only keys of sizes 16, 24 or 32 supported in /in/VHfHY on line 17
Output for 5.6.12
Warning: mcrypt_encrypt(): Key of size 19 not supported by this algorithm. Only keys of sizes 16, 24 or 32 supported in /in/VHfHY on line 9 er4QhZ+182rdjcQoAxOwyg== Warning: mcrypt_decrypt(): Key of size 19 not supported by this algorithm. Only keys of sizes 16, 24 or 32 supported in /in/VHfHY on line 17
Output for 5.6.11
Warning: mcrypt_encrypt(): Key of size 19 not supported by this algorithm. Only keys of sizes 16, 24 or 32 supported in /in/VHfHY on line 9 NpRQ4wIfpqYjiXWbZ8bEJg== Warning: mcrypt_decrypt(): Key of size 19 not supported by this algorithm. Only keys of sizes 16, 24 or 32 supported in /in/VHfHY on line 17
Output for 5.6.10
Warning: mcrypt_encrypt(): Key of size 19 not supported by this algorithm. Only keys of sizes 16, 24 or 32 supported in /in/VHfHY on line 9 DOBnzC5YbPFzry14M8qJpw== Warning: mcrypt_decrypt(): Key of size 19 not supported by this algorithm. Only keys of sizes 16, 24 or 32 supported in /in/VHfHY on line 17
Output for 5.6.9
Warning: mcrypt_encrypt(): Key of size 19 not supported by this algorithm. Only keys of sizes 16, 24 or 32 supported in /in/VHfHY on line 9 tz3OVwFmXsiWHM7jlOLxzQ== Warning: mcrypt_decrypt(): Key of size 19 not supported by this algorithm. Only keys of sizes 16, 24 or 32 supported in /in/VHfHY on line 17
Output for 5.6.8
Warning: mcrypt_encrypt(): Key of size 19 not supported by this algorithm. Only keys of sizes 16, 24 or 32 supported in /in/VHfHY on line 9 yM6nS+/4aUgN+hW7dG0dpA== Warning: mcrypt_decrypt(): Key of size 19 not supported by this algorithm. Only keys of sizes 16, 24 or 32 supported in /in/VHfHY on line 17
Output for 5.5.34
gBcGqESDa9JJuC7RSC02KhQLHNTiIOIqRCxRDUU4T9mEygPQcP/eAlwUdNHdsoIWtest
Output for 5.5.33
6NWhLdTb+3YguNxmxH8/uy8c8uGXpIhloKEdbi3jaALUsgGwhylZGuG10AbJQbfdtest
Output for 5.5.32
5iZxX+y/86sDL2ChgnHz+ZCY7DS1fXh7c5vfmO2ewJFfDxXzeu5pdvut5JeAsT4xtest
Output for 5.5.31
ilUFl8OMLG9SfkPh8PNb8VNIUxDe8Pmk/4jBy6mjsEDG7IDR9C2dRQtRpGRhSw2Atest
Output for 5.5.30
B6HGAs8ltN2v+gAXrqZKEWaDTCKWNDrcC8nn+/l/XLum+1VYIAUZzAfORZgyc+FEtest
Output for 5.5.29
5z3+k4rIO8BReREFYTeNtQpAu5hWbbc5K4V3MW25Xr3uv0GXIclrW3fuHFDsYNtYtest
Output for 5.5.28
mOSUNDWDEWvJkbnaLhHYEJoraL6uN4Yhfl2bsydBb281Gq1YA9riDpiam0h8uquOtest
Output for 5.5.27
wVAkhAicfyu+z/XKh2+KKImvF+MO0e2lK5ieh37IR4phBkSv1ISY+Fxl/DRVFCOOtest
Output for 5.5.26
pnpPOVFCATfy+SdcDgI3FTfbXo1Y+7/4c24RlUczV267pZKr1bBnXsJTpM8GcALhtest
Output for 5.5.25
x8KR74wFn0Bi/AHa53/3Sqthd5bzw/yGY+952tpc1Gv4uUmzSn5LlgXtJzjDlzcztest
Output for 5.5.24
aH+uEnhBy8YDYeFHegojA2ZwV3JTKKzSuaW/IH8Y4Gb6EXo6BnyjntYWcHF1u+nVtest
Output for 5.4.45
D7tVEkaju+c02NzwYjaldPHcYKMEhgz53ocynQUMMPWtGLnmOlX60RWK7U3YO8kmtest
Output for 5.4.44
6p2bsH2esu9QiqYitIlZH2UtymVAcXmJaedKj15K3dvl+fvK8lqnJOg5pXeBxrpktest
Output for 5.4.43
SwbmRVR36Cl6x8B67SOGBxQ4qpkrnafGF+xRQoriti7GoGZmKXRdnNo0jdlJhCBBtest
Output for 5.4.42
bbiM5E2FaIV8guL38phBS2jjEAKQou76i/z4mYegyeL9JmV894LC/O/BB2Tu5tr3test
Output for 5.4.41
XS1L6FbYJmr7rklKbwxsCYDfnXNnkUTszOIKZIgZ7wSuF/sYJsi89L3jxQyE6YDEtest
Output for 5.4.40
05dbYnzc9vVilgy3nhw7Son9V0Ewre009pZ++R/CTcB6oy1PEutXGGvK2ZMiMDxetest
Output for 5.4.39
GZ+USvBPR7VIhAqTfxwrDSjq9nvk8uUkgCf9ZPur3FtfcpZ7KEjA6L5Ec4426595test
Output for 5.4.38
CMbrw8RUGER0GSoXfw0rOsG0vrdiNNkfXe9QnxBuT/haWT58XNv45wq9SkXxsatptest
Output for 5.4.37
YM9vcrJXPIiB8funXDkyLCZ6A4SE2gv+VSkeYfaebcrmFyEVprdJRslYfV35/+pttest
Output for 5.4.36
KzlR2FpUOtTSb4pnMYcMk2ZwGF8RGzY2FQDFs706WcQbWr+GpBrj2mOI+iiRIXZLtest
Output for 5.4.35
mREhfFf3SKdtugHUg2Xl5K4nz6abX2oXBCCN7Ey1ODW+KDyg0FBwYj5JRIQ8hNkwtest
Output for 5.4.34
Pl6j8JxboDlO2ifvHLTwz80D3rkV0oN6WdUeT/xvzDDuIPfg9CZX+i4ispZsQgMqtest
Output for 5.4.32
YH3IdzegGub9MWv0UFWnRhutXzzKF5ldH9U1+wnJ7Tuj+DkTskukR4Cxosh/AYpotest
Output for 5.4.31
mPF6+cvLThhVMvMpRl69N1MOgRF8c7d/jElZ7ScZ+pzdEg+k5v8bDx3EdQkQD27Ttest
Output for 5.4.30
wIv1MXxVlWoZBAQZ/ZZJZQcWjep1hXFNazkUZKqW/zh82+Vno48exQ306sVM7p8Xtest
Output for 5.4.29
ELxHsZnoNteM40dMhR/Cnr6oOsxdjFa39B5MLN8bIbPyD+yKc6GKaUbvqwOfSbW4test
Output for 5.4.28
lYUhoUXVrCIDE9AwU+CjxbgaZsoHFmLAVsO5qBDDZjr/PbS+PCyC+BoFuoFWG38Ptest
Output for 5.4.27
fyXKUNAKUpM0fMXi/EFmEfe9f9GJECIGTLpatVK15hKigYXqxEApSPbGg6nEeIKStest
Output for 5.4.26
7iaC4FO5o3t+YeAyaKxggHj3WOrS8u6/Ko+iJDc8A12i7tOMkmvfY47EswRKA0oxtest
Output for 5.4.25
1zFUxTB3neiWZW+/Lm9dUlKSzdUktTW6oiArDFp0btBbGOQvaf3/tr8sTtS56h5dtest
Output for 5.4.24
ZZsmp6rQ4SguXo7Syokon+e1zWryNuVxGsEAp1S57yIhqxoqFFhbsUEhfUmfm2nRtest
Output for 5.4.23
Y8qbDj6FSmFVG5EExLcHwIu7dk/JtUnd/xUaLkam7rSHCrouGtCjE1EldWiimYKptest
Output for 5.4.22
yhq5tiFzJRKrv8F5FHvkQXkNZ5G0JcVYGdgiWpXhQkvEi5uAmm2G9FuHdyYfSz1itest
Output for 5.4.21
y5d1EH/bH5J7Qyb7QDaUxKfiXb0EUWzVob3F+K8yRNtR7on7Q6fWr37CER6LML55test
Output for 5.4.20
RdMb2tRhyayL8JVg/pH2qzAzuOywRfZJDs0t2pAQ6cYrDtYhEZjPAZ2uQ1LBikKEtest
Output for 5.4.19
bI2qv3A7weUIWEA8HujlEyPUl3avfQISUcl02PPaFv2lK3zik1eR8aT18eq+KqPutest
Output for 5.4.18
Pu4w028KbHNH7zKTHCXRllP5ZHMhVMqD60G8PijmEWCSk3wB+gvyxxHPKBZ6XeV7test
Output for 5.4.17
Y2vlVg+piWaXaF57q+oy64OhRWSPvtsIp9w5JFZbP2aQdv0kDhbtp5LQlKc0hZALtest
Output for 5.4.16
Vqcn/prnYDTSZSeoO/55xNPYFi7xvB5nfwEjzCGVa39jTIO8CEvlLVIdoueQxthmtest
Output for 5.4.15
EZo23KPIkhL2t5VvuSiYO2ANnfC9qj2mCbf02pbc+thVcPpUgcv6votB0/qM8GErtest
Output for 5.4.14
STyYpawAKfujjrAzbwQZEcw5+80w2KuuXQ2Qjx6AI0mi88pklGrnFl/o0alra7Nftest
Output for 5.4.13
YAcHSK+cgZvRw8YUQyebfBwopQTf9sPBnhIFdjqgmgVbPVS5QdpzIg23oxu88VF6test
Output for 5.4.12
PyaShWhAqm71fiu2694dVjVmBy/uklwwoD7Ixeu896FXsugphRCWWivQrjVy9oNatest
Output for 5.4.11
MsBdKgSitvSe3nXi5+TQ6eU+hU8fy7LLz7xIpHx0qECO+sfU+KNHaj6xa59N3+Qatest
Output for 5.4.10
qYqZc5DtRYo/6TEdzWBGnn601OXZVp9NovX7MFUOoUiihppjxDKf7VfyAxHQEHcOtest
Output for 5.4.9
r8766W4dzThgLUThmVV/9dGbHln3HJH5oZ6UnMh+FGRGlgJVWluzTjkXkCCG4nZ0test
Output for 5.4.8
WRn1P23Z3NLdhcpfHFpJ8k6n3E3JaYqm4st8MclnrqPRJ1yL2zCQK5TadcjkxP8Ztest
Output for 5.4.7
A4NeFd12W6fjV+vEfFGeU5mKBVHVQpiBlvfEJdwtwOp3sJMcO9YwDUgUpRHHXt2Etest
Output for 5.4.6
Cqb5vrNYASq4EdUMmCYaxbwfUCr1iYUPseZue8mravmr78AAqpZlDWUt6qpVvxL3test
Output for 5.4.5
UNGJiho6chqIIwrlTcs/p3VHdiDkOOMuYKnkMZ7FcNzZVLBDkL62xf0lPXihvrY+test
Output for 5.4.4
Bw9hId7YEfvfhBx8DUGn28wnhOtNQnrwYyIvnesLka3uKTkYMTwXOvE+ljPrBV4Ltest
Output for 5.4.3
lzRwg8DjV5VEYWXqJ8y3K3WEWEuO/hLtQONg8Tf5ieb6cCYCOFqSTf/5AKIvVB7Dtest
Output for 5.4.2
Ll+sS8/jaUowX9f3GPniAnz10Th276Vo2n8aR8skGr4CPcVj5KySUenp4IA40Jcztest
Output for 5.4.1
7edioWvc1uxpfHkXgHXkqIZwgPh4et7jmIKYv2FAYlYcyEiAgnj+IbwxU/W4aaqftest
Output for 5.4.0
tB/AEERAWiz68x37dtFVgsuhU42PlJOdGUnFE1CpQvrOsMLkmEtdcqWm/uUolKjGtest