3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php /** Name: PHP Encryption: Desc: Encrypt and Decrypt data. Version: V1.0 Date: 3/11/2017 Author: Prince Adeyemi Contact: prince@vegasnewspaper.com Facebook: fb.com/YourVegasPrince */ // Encryption setup: $dataToEncrypt = "My Secret Telegram: Hakuna matata!"; $encryptMethod = "AES-256-CBC"; $mySecretHash = "somethingRandom12!)!)I!@1U2 goes gere"; //$iv = mcrypt_create_iv(16, MCRYPT_RAND); // php versopm 5.x/7.x compability; If( phpversion() >= 7) { $bytes = random_bytes(8); $iv = (bin2hex($bytes)); } elseif( phpversion() < 7 ) { $ivLen = 16; $iv = str_repeat("\0", $ivLen); } else { $iv = mcrypt_create_iv(16, MCRYPT_DEV_URANDOM); } //Encrypt data: $encryptedData = openssl_encrypt($dataToEncrypt,$encryptMethod,$mySecretHash, 0, $iv); //Decrypt data: $decryptedData = openssl_decrypt($encryptedData, $encryptMethod, $mySecretHash, 0, $iv); //OUTPUT: echo ("RandomIV : " . $iv . "\n"); echo ( "Secret message : " . $dataToEncrypt ."\n" ); echo ( "Encrypted message : ". $encryptedData ."\n" ); echo ( "Decrypted message: ". $decryptedData ."\ln"); ?>
based on WaYTg
Output for 7.2.1
RandomIV : f0e443162d697b8b Secret message : My Secret Telegram: Hakuna matata! Encrypted message : lYm4HB5q6KASqtabJPE79Uwy1T2FOogxbMDR6AnT1y8+xv3Uayvcq+ttqU10j1sw Decrypted message: My Secret Telegram: Hakuna matata!\ln
Output for 7.2.0
RandomIV : da84b0341c990bfd Secret message : My Secret Telegram: Hakuna matata! Encrypted message : KSENsZjhknTA0IKhs7spmW8gw5p+tVHlSUp/KmGJGhCh479at2isqmePj5uxFjaz Decrypted message: My Secret Telegram: Hakuna matata!\ln
Output for 7.1.13
RandomIV : 6ac6a485a73aa753 Secret message : My Secret Telegram: Hakuna matata! Encrypted message : 98IuPUvGIUaOcL1FSDJSpjdYSnARpml8K9oej1rBKmlVr4JZXA5RxNz8jK9pc9RH Decrypted message: My Secret Telegram: Hakuna matata!\ln
Output for 7.1.12
RandomIV : 077e2a0ef04eed75 Secret message : My Secret Telegram: Hakuna matata! Encrypted message : Pyew87lS/EbCvDBltV9rVN1+cQZ/Si1OWSCWLCyA7Jc+SufIvexxzWV0ZrPj9Ckc Decrypted message: My Secret Telegram: Hakuna matata!\ln
Output for 7.1.11
RandomIV : feff7e4b9a5d45ea Secret message : My Secret Telegram: Hakuna matata! Encrypted message : MTIluF1CxRWe4Rkz3KFkMaA7gkppzvgCTo3DHDSR67sqZwGBznf7iwa+0p/3D/pR Decrypted message: My Secret Telegram: Hakuna matata!\ln
Output for 7.1.10
RandomIV : 7370c8b27bc99766 Secret message : My Secret Telegram: Hakuna matata! Encrypted message : dlKLeT5hEyEUgOVbdT9LFy2TfQGm16F4UW5SoPDzGCYlBt0oc+1za0asKHeAHlv8 Decrypted message: My Secret Telegram: Hakuna matata!\ln
Output for 7.1.9
RandomIV : 5cd26456cd952677 Secret message : My Secret Telegram: Hakuna matata! Encrypted message : INVnwelvZjOv6ZJAKDJAyFQPD/rf+ppPcYTwzHeXRNoMp3O/6weee4Kngv9e9mjZ Decrypted message: My Secret Telegram: Hakuna matata!\ln
Output for 7.1.8
RandomIV : 9e663be13bafa6d7 Secret message : My Secret Telegram: Hakuna matata! Encrypted message : m7Q+YSRwtyip5gte5iUnTyOLxeKsszDBh043vHHHDlKqB3e92KPPDVukMRcSebeA Decrypted message: My Secret Telegram: Hakuna matata!\ln
Output for 7.1.7
RandomIV : 03843c42eeb39e5e Secret message : My Secret Telegram: Hakuna matata! Encrypted message : Vj9D1SHXE73/7KmGoYE8uqvnKWi15tJP8AhqbDaIYxsMx4L1b+vrwXmemc024BCd Decrypted message: My Secret Telegram: Hakuna matata!\ln
Output for 7.1.6
RandomIV : d6cf3862d5b24397 Secret message : My Secret Telegram: Hakuna matata! Encrypted message : /tOGL5+FmTfcjDoDwtofyempOCjm1O9qTwje0585apVhFQCoSlEO1FAIE5Txyfz/ Decrypted message: My Secret Telegram: Hakuna matata!\ln
Output for 7.1.5
RandomIV : 566ed6227f7bc2fe Secret message : My Secret Telegram: Hakuna matata! Encrypted message : 4IpFYDkg+A+8agJsNufaCp2N9nXiytZdQ96rykUIJ+Plok1qz4k0fJXn/Q9+jR6u Decrypted message: My Secret Telegram: Hakuna matata!\ln
Output for 7.1.4
RandomIV : e41c3d03820bc55e Secret message : My Secret Telegram: Hakuna matata! Encrypted message : a7tBJn1CihV6ndU/mkwMT4xmFMwNCT3sZFqWHDtkIAuk1r4whb8i2pBdUR8M9WQE Decrypted message: My Secret Telegram: Hakuna matata!\ln
Output for 7.1.3
RandomIV : b89f5c03aa640dc8 Secret message : My Secret Telegram: Hakuna matata! Encrypted message : 4XZRFaBj8taFQ/CMmCO07mtptz5ct91xFIYteESzH52tLOMv9yAe4/3ghlRGvJW5 Decrypted message: My Secret Telegram: Hakuna matata!\ln
Output for 7.1.2
RandomIV : a200ccff80d4b555 Secret message : My Secret Telegram: Hakuna matata! Encrypted message : CBJ+5Ad60wbzvaH86iwg5Jb3kCeVTsPX3De2KkIoCSttUw3TccGoS0id1zxgZU41 Decrypted message: My Secret Telegram: Hakuna matata!\ln
Output for 7.1.1
RandomIV : 468832ab277e136a Secret message : My Secret Telegram: Hakuna matata! Encrypted message : 0MPEcKEaQPlwuI8YyFEmAgycIfl4OzoLYwpEsEgE641DtwhITq5xXIobKIZwHfDN Decrypted message: My Secret Telegram: Hakuna matata!\ln
Output for 7.1.0
RandomIV : 1bb28207383b4925 Secret message : My Secret Telegram: Hakuna matata! Encrypted message : XhSFd9SMf9JjRVe6buftiUmf603d6vuBau4oiYpCfjm+fBSXCyyEG3S0CNexuode Decrypted message: My Secret Telegram: Hakuna matata!\ln
Output for 7.0.27
RandomIV : c9589219bf6dc6ea Secret message : My Secret Telegram: Hakuna matata! Encrypted message : kolXipkDxAyDJQBETLNlrn93z19RDM7UidluxN3E4mKMYML1EEuF0yDFy2Yk13kA Decrypted message: My Secret Telegram: Hakuna matata!\ln
Output for 7.0.26
RandomIV : 95541daab8b63ad8 Secret message : My Secret Telegram: Hakuna matata! Encrypted message : gNBNe00mquABeoZFTfh5Dn1yUAoWDaJLxCih16NwlIGmeqxjrUYMny4syQQV3gpn Decrypted message: My Secret Telegram: Hakuna matata!\ln
Output for 7.0.25
RandomIV : 85478d9e74189e23 Secret message : My Secret Telegram: Hakuna matata! Encrypted message : 9tvqlg5fWJZ1hOFxbtxDeesYgqDBBS2NzOul66zJFV7Ne3u+uPNU7EIQiwgL2PjY Decrypted message: My Secret Telegram: Hakuna matata!\ln
Output for 7.0.24
RandomIV : 4f21758c586b7444 Secret message : My Secret Telegram: Hakuna matata! Encrypted message : 9inrHeaF0sr5zaZTafsAQMzWDag5MFNg1HjVo91TX02DAxiVm6NiRHyp3kjaTH70 Decrypted message: My Secret Telegram: Hakuna matata!\ln
Output for 7.0.23
RandomIV : 2990a68d604ac8dc Secret message : My Secret Telegram: Hakuna matata! Encrypted message : crQpVVqhe7iyPZt2MCY0Xq7ign552Pqos5+cFaJwR9YACFzL0XrpbIVu14wFemKo Decrypted message: My Secret Telegram: Hakuna matata!\ln
Output for 7.0.22
RandomIV : 0178d50d89d6338c Secret message : My Secret Telegram: Hakuna matata! Encrypted message : 691mbZmUU++YE34VLNw2xejqU5HHz8DQtSVBfOEJnq8Zof2PVWnHcDBDqiIouYJv Decrypted message: My Secret Telegram: Hakuna matata!\ln
Output for 7.0.21
RandomIV : 402f8513fc38db93 Secret message : My Secret Telegram: Hakuna matata! Encrypted message : J6swCuNePW//YFn34KgMoN3fAbqulCcEeAuKfnJxYJ3aiH5jBiE80KHCnJgXmJLf Decrypted message: My Secret Telegram: Hakuna matata!\ln
Output for 7.0.20
RandomIV : 79b2b720a5f2d86c Secret message : My Secret Telegram: Hakuna matata! Encrypted message : kaI7XOcRfYteV7YjVush7yGB7fwzRAFlqJhbNoT1UakT9u/HTNmJvtvBCNT8oF88 Decrypted message: My Secret Telegram: Hakuna matata!\ln
Output for 7.0.19
RandomIV : 95ec0244e08b67f7 Secret message : My Secret Telegram: Hakuna matata! Encrypted message : PTwR5gdEPB7SMxPWG+ZhNz/101+vftlXU5l6ANSOkrOZMloePZ534+hg0Tk92o28 Decrypted message: My Secret Telegram: Hakuna matata!\ln
Output for 7.0.18
RandomIV : e3109c80ecb455c6 Secret message : My Secret Telegram: Hakuna matata! Encrypted message : 7g7s1L4dPfwljPS+Y012TykX9c71QKghvP12opVhPGdcGoHceHorfg/Z1+um3MsQ Decrypted message: My Secret Telegram: Hakuna matata!\ln
Output for 7.0.17
RandomIV : 5eb6a84017b9d9de Secret message : My Secret Telegram: Hakuna matata! Encrypted message : S2VXvilSIYvr0kXYA40rdkiCU1pCzcyodH61YqhG0CzfVfeYpoYtG9tU4/ga5jqe Decrypted message: My Secret Telegram: Hakuna matata!\ln
Output for 7.0.16
RandomIV : 92291275db16ef0e Secret message : My Secret Telegram: Hakuna matata! Encrypted message : kdHsPgwUkWBQyD+0jLUJwwrt0DKdMMCuABXVJAXfpcl+9WLNGFk+XLKwD5EvpM+l Decrypted message: My Secret Telegram: Hakuna matata!\ln
Output for 7.0.15
RandomIV : 975923a7d49e7b20 Secret message : My Secret Telegram: Hakuna matata! Encrypted message : FmHMgHKeM/Jsn0t1dIUSXyHIzLJ7IFeCeGCh3vVYz3wc2m0//DGwD3MHwWaBb/3I Decrypted message: My Secret Telegram: Hakuna matata!\ln
Output for 7.0.14
RandomIV : c4bb38585139232e Secret message : My Secret Telegram: Hakuna matata! Encrypted message : mmPTGHove2vAKEdw11ucTlA6exqxfiiwvvxwmy1SxcAhB7Mv1XnorN3HiTmkiw0g Decrypted message: My Secret Telegram: Hakuna matata!\ln
Output for 7.0.13
RandomIV : 864cb68aa5eff596 Secret message : My Secret Telegram: Hakuna matata! Encrypted message : nevIx/VJij/vd14nxXnb66KQ6SqZKnI1PWp7vR03hVUszYkIPX3KAHbeBIv8RrN4 Decrypted message: My Secret Telegram: Hakuna matata!\ln
Output for 7.0.12
RandomIV : 103e1cde9a439b39 Secret message : My Secret Telegram: Hakuna matata! Encrypted message : qCYzRKd+/Vk4kqM+JaN0WiT2uQo+Q/T1O8wbuuCGY7EqrM6HRU9KsZ81zBMOqnHD Decrypted message: My Secret Telegram: Hakuna matata!\ln
Output for 7.0.11
RandomIV : 121f7abc25e03d1b Secret message : My Secret Telegram: Hakuna matata! Encrypted message : USVYe/JMVt7xpRAtKkXpW/Q+1bCZYJN3DcbJwsXk5zo/d6xM8ui9lL7IW93r3RVa Decrypted message: My Secret Telegram: Hakuna matata!\ln
Output for 7.0.10
RandomIV : 4914d4dac99dd63c Secret message : My Secret Telegram: Hakuna matata! Encrypted message : KQ6maAK1/hC6DnWSPxV+qWTakO3ZCgDUeIW2dZmgr/XUF+bE7s+UOGgvmNjKAvF7 Decrypted message: My Secret Telegram: Hakuna matata!\ln
Output for 7.0.9
RandomIV : fdeacc18a21d7a29 Secret message : My Secret Telegram: Hakuna matata! Encrypted message : FLjnMJ6NJGeIZjnTCvCvlsm1J42mHdjTRgfmry6o2LvzZLkODihT3ooOyQHgxec4 Decrypted message: My Secret Telegram: Hakuna matata!\ln
Output for 7.0.8
RandomIV : 700552b0b5b97b09 Secret message : My Secret Telegram: Hakuna matata! Encrypted message : 7hM0Qi/tMXMYNaRZwtlQjxyxpPBqKfC+I1n3m5yMQJ5iDDyuG2RGD6na4O5pTa5a Decrypted message: My Secret Telegram: Hakuna matata!\ln
Output for 7.0.7
RandomIV : b294acbe2cf5d4d5 Secret message : My Secret Telegram: Hakuna matata! Encrypted message : gWAz1lHrsfge7pNfdA2K0MP3JBUFnfwDQHVUFwuSDOAEpJ9+vmIcgHj2AfZgT3Wj Decrypted message: My Secret Telegram: Hakuna matata!\ln
Output for 7.0.6
RandomIV : 964971e64a43384b Secret message : My Secret Telegram: Hakuna matata! Encrypted message : lZyW0kyZE2uFj+Xke4YDXe5MHIYp1rlUcPt8DCMCuEof64p5iMmblh/5kMcbea+/ Decrypted message: My Secret Telegram: Hakuna matata!\ln
Output for 7.0.5
RandomIV : 24eb453ba0a225aa Secret message : My Secret Telegram: Hakuna matata! Encrypted message : KwdGWJP3Vv5en7A2mLysN1qAq/4gps6gMVFOoKS1W/t4G4EkfX0TXdDy5V5NoM0p Decrypted message: My Secret Telegram: Hakuna matata!\ln
Output for 7.0.4
RandomIV : 154a7bdefdcb94cc Secret message : My Secret Telegram: Hakuna matata! Encrypted message : 0u9eWdRQpezKxb31ErWXbSHajlYMOkEQWy0G9zbZbbz1we6+N+cpDsk3RdU7ft8D Decrypted message: My Secret Telegram: Hakuna matata!\ln
Output for 7.0.3
RandomIV : 121901ace48cc3e2 Secret message : My Secret Telegram: Hakuna matata! Encrypted message : 60GlCLoa52NTqgbVJvSbW7vtDtI+9yM/kHcEp8NQR7yM81F7kQi9biYHVISkqKCX Decrypted message: My Secret Telegram: Hakuna matata!\ln
Output for 7.0.2
RandomIV : 5e3fc19dad880303 Secret message : My Secret Telegram: Hakuna matata! Encrypted message : 5z0X6vpmsYZ3AaykWEzshqYdvK/Jhye2qa6HxkXO4O49YDAXGSOVuTvMj3DvSVuJ Decrypted message: My Secret Telegram: Hakuna matata!\ln
Output for 7.0.1
RandomIV : 06e55fba34af1227 Secret message : My Secret Telegram: Hakuna matata! Encrypted message : nc6fzj2fvFtfRySjZS+/M/fE7T5qNip9uGhnCqLXOUDs9FBv5A3FzqtID5AJttFu Decrypted message: My Secret Telegram: Hakuna matata!\ln
Output for 7.0.0
RandomIV : 7e5547566de9d68f Secret message : My Secret Telegram: Hakuna matata! Encrypted message : CwOYmozTMeYFVF9ZigM93ZByxWtA1+7yAiIiQ7caLf1nD7w7QGxz0dWd3HL4chcc Decrypted message: My Secret Telegram: Hakuna matata!\ln
Output for hhvm-3.22.0
RandomIV : 04c93a67ff102bbc Secret message : My Secret Telegram: Hakuna matata! Encrypted message : s6DHNxXT6pyhcfKogviIg1saHci1LfRGJ4/PFTD/b00WDuxionGFl3vMswP298ub Decrypted message: My Secret Telegram: Hakuna matata!\ln
Output for hhvm-3.21.3
RandomIV : 3df876b949adf5b3 Secret message : My Secret Telegram: Hakuna matata! Encrypted message : /74r5BcTZ5/S/iXGChRpzNdZ4uCLmH0mpaNS2COTlrxD5IUhF+7//YF4HEVpgj3I Decrypted message: My Secret Telegram: Hakuna matata!\ln
Output for hhvm-3.18.5
RandomIV : ee3ba15a7a64e3d9 Secret message : My Secret Telegram: Hakuna matata! Encrypted message : 5NdbJ6vxtH+6f+oK+Phl/XKnmJJwfmJ2e2xZaurPHZsDclpyFuUyC04WOprL0UF+ Decrypted message: My Secret Telegram: Hakuna matata!\ln
Output for 5.6.0 - 5.6.30
RandomIV : Secret message : My Secret Telegram: Hakuna matata! Encrypted message : 8MDZns9vCGDZsc4deE7Wm+C96rpoWMWLQ/UqEY9TiuD9D0x2GmsM3KepdFFE0aWf Decrypted message: My Secret Telegram: Hakuna matata!\ln