3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php /** * Main Code By: Khucing Ithem : https://www.facebook.com/backcat * Make with Class by: hrace009 **/ $data = 'Text ini akan di encrypt menggunakan openssl! dan akan di decrypt dengan openssl juga'; $secretKey = 'mykey'; class MyCrypt { public static function safe_encode ($text) { return md5(trim(strtr(base64_encode($text), '+/=', '-_,'))); } public static function safe_decode($text) { return md5(base64_decode(strtr($text, '-_,', '+/='))); } public static function encrypt($data, $secretKey) { $iv = openssl_random_pseudo_bytes(openssl_cipher_iv_length('AES-256-CBC')); $cipher = openssl_encrypt($data, 'AES-256-CBC', $secretKey, 0, $iv); $safe_cipher = MyCrypt::safe_encode($cipher); $safe_iv = MyCrypt::safe_encode($iv); return $safe_cipher . '::' . $safe_iv; } public static function decrypt($encrypted, $secretKey) { $token = explode('::', $encrypted); $cipher = MyCrypt::safe_decode($token[0]); $iv = MyCrypt::safe_decode($token[1]); $plain = openssl_decrypt($cipher, 'AES-256-CBC', $secretKey, 0, $iv); return trim($plain); } } $encrypted = MyCrypt::encrypt($data, $secretKey); $decrypted = MyCrypt::decrypt($encrypted, $secretKey); var_dump('Encrypted: ' . $encrypted); var_dump('Decrypted: ' . $decrypted); ?>
based on bO2BK
Output for 7.1.7
Warning: openssl_decrypt(): IV passed is 32 bytes long which is longer than the 16 expected by selected cipher, truncating in /in/r1bfq on line 36 string(77) "Encrypted: 4aa4fee0a1218b28fd8cbdeff5cbabcc::0fac45f398d8b649a70a6681d2e52d9b" string(11) "Decrypted: "
Output for 7.1.6
Warning: openssl_decrypt(): IV passed is 32 bytes long which is longer than the 16 expected by selected cipher, truncating in /in/r1bfq on line 36 string(77) "Encrypted: 709ed2219da75acef3ac915c438a210e::854794b4851bc4ec20bf40f859beb35e" string(11) "Decrypted: "
Output for 7.1.5
Warning: openssl_decrypt(): IV passed is 32 bytes long which is longer than the 16 expected by selected cipher, truncating in /in/r1bfq on line 36 string(77) "Encrypted: 70726ebdcf377a0f75d1162172f2b577::80f6fa69d57412e09ac88c2bbac38171" string(11) "Decrypted: "
Output for 7.1.4
Warning: openssl_decrypt(): IV passed is 32 bytes long which is longer than the 16 expected by selected cipher, truncating in /in/r1bfq on line 36 string(77) "Encrypted: 12ae48eef82a4447dde040949b2bed5a::ccf004f7f8001eb43298da148d6f9d72" string(11) "Decrypted: "
Output for 7.1.3
Warning: openssl_decrypt(): IV passed is 32 bytes long which is longer than the 16 expected by selected cipher, truncating in /in/r1bfq on line 36 string(77) "Encrypted: 49b3e0f700f987d76c7bbb57dc356acd::c44df45ffe4f5950b29fc1865f96638d" string(11) "Decrypted: "
Output for 7.1.2
Warning: openssl_decrypt(): IV passed is 32 bytes long which is longer than the 16 expected by selected cipher, truncating in /in/r1bfq on line 36 string(77) "Encrypted: ea938874c6154f6d02fa24fb1e3fe016::f28c2e9f6209c42aaee2180c75dabed5" string(11) "Decrypted: "
Output for 7.1.1
Warning: openssl_decrypt(): IV passed is 32 bytes long which is longer than the 16 expected by selected cipher, truncating in /in/r1bfq on line 36 string(77) "Encrypted: c6015f2eec7f338dc03f9a0b8f074552::d3753c7248707fcd53d6471dae803dbc" string(11) "Decrypted: "
Output for 7.1.0
Warning: openssl_decrypt(): IV passed is 32 bytes long which is longer than the 16 expected by selected cipher, truncating in /in/r1bfq on line 36 string(77) "Encrypted: 13a6547461f2990f954274c95cc574ee::e7578178344591f0cb916dc81cb3746e" string(11) "Decrypted: "
Output for 7.0.20
Warning: openssl_decrypt(): IV passed is 32 bytes long which is longer than the 16 expected by selected cipher, truncating in /in/r1bfq on line 36 string(77) "Encrypted: 94a8d777bee5f5ba70ac4f0d19e52625::d3f790c6178c02e5d9ce9a61ed1278ab" string(11) "Decrypted: "
Output for 7.0.18
Warning: openssl_decrypt(): IV passed is 32 bytes long which is longer than the 16 expected by selected cipher, truncating in /in/r1bfq on line 36 string(77) "Encrypted: d15588827d37a56829ad6729e88eb521::66d5375fdb4dd176fe00b0eab5d6a8db" string(11) "Decrypted: "
Output for 7.0.17
Warning: openssl_decrypt(): IV passed is 32 bytes long which is longer than the 16 expected by selected cipher, truncating in /in/r1bfq on line 36 string(77) "Encrypted: c0c228f1f6e647cc27401e736146e0ea::813e3ef1a700bc5dd1637a6bdaa5f441" string(11) "Decrypted: "
Output for 7.0.16
Warning: openssl_decrypt(): IV passed is 32 bytes long which is longer than the 16 expected by selected cipher, truncating in /in/r1bfq on line 36 string(77) "Encrypted: a40f4be2b220e1e1a60a4cb571d95f3b::4284c6d4c2fff903d96732f1bf601466" string(11) "Decrypted: "
Output for 7.0.15
Warning: openssl_decrypt(): IV passed is 32 bytes long which is longer than the 16 expected by selected cipher, truncating in /in/r1bfq on line 36 string(77) "Encrypted: 440e834366b294b83fc3352cc3d87754::ab2c0e5c3190f776d2f562af275b6ad3" string(11) "Decrypted: "
Output for 7.0.14
Warning: openssl_decrypt(): IV passed is 32 bytes long which is longer than the 16 expected by selected cipher, truncating in /in/r1bfq on line 36 string(77) "Encrypted: 3ae5fac42a17cff8a006c0e205cfe1e2::478e4113970be0984685338ba059f224" string(11) "Decrypted: "
Output for 7.0.13
Warning: openssl_decrypt(): IV passed is 32 bytes long which is longer than the 16 expected by selected cipher, truncating in /in/r1bfq on line 36 string(77) "Encrypted: 792c2a4a42b9f1633c6eba9cd3f0fb7a::bf81f46de7df30a7b3c4382a844ab4db" string(11) "Decrypted: "
Output for 7.0.12
Warning: openssl_decrypt(): IV passed is 32 bytes long which is longer than the 16 expected by selected cipher, truncating in /in/r1bfq on line 36 string(77) "Encrypted: e2229c4681e192c3146d42b84f9a4f7e::8a1f3f224d46b029287c07e22ca502cb" string(11) "Decrypted: "
Output for 7.0.11
Warning: openssl_decrypt(): IV passed is 32 bytes long which is longer than the 16 expected by selected cipher, truncating in /in/r1bfq on line 36 string(77) "Encrypted: f04d21b011de8bd0d7079da85b0d4a32::8abe87ebfdf39fb2b4e4b7c67737cd42" string(11) "Decrypted: "
Output for 7.0.10
Warning: openssl_decrypt(): IV passed is 32 bytes long which is longer than the 16 expected by selected cipher, truncating in /in/r1bfq on line 36 string(77) "Encrypted: 1196d2693935124e0b9861de14b868b1::65dc3c911aeed3d15afbf1b6056f82aa" string(11) "Decrypted: "
Output for 7.0.9
Warning: openssl_decrypt(): IV passed is 32 bytes long which is longer than the 16 expected by selected cipher, truncating in /in/r1bfq on line 36 string(77) "Encrypted: 7457a258da8728f6fd74eeec8ac09566::34ba2c346e27bb0ec957330e1ae3983f" string(11) "Decrypted: "
Output for 7.0.8
Warning: openssl_decrypt(): IV passed is 32 bytes long which is longer than the 16 expected by selected cipher, truncating in /in/r1bfq on line 36 string(77) "Encrypted: 3ddb6c8a966be7100d23828cd0681a6e::eb33643a7bc79c05a14265588b81c122" string(11) "Decrypted: "
Output for 7.0.7
Warning: openssl_decrypt(): IV passed is 32 bytes long which is longer than the 16 expected by selected cipher, truncating in /in/r1bfq on line 36 string(77) "Encrypted: ff656eb456536328ac3aa11799d97ef2::36eb71684f348308b64227d147116271" string(11) "Decrypted: "
Output for 7.0.6
Warning: openssl_decrypt(): IV passed is 32 bytes long which is longer than the 16 expected by selected cipher, truncating in /in/r1bfq on line 36 string(77) "Encrypted: 42ad26ec2cd32d891a6fe9e61c3e1711::d9905bb46e4fd3070219ef3240ab4c2f" string(11) "Decrypted: "
Output for 7.0.5
Warning: openssl_decrypt(): IV passed is 32 bytes long which is longer than the 16 expected by selected cipher, truncating in /in/r1bfq on line 36 string(77) "Encrypted: aa1b42a19e48b1c10073ffcff6d28f13::8021e0b0330b1be31508f7612346955a" string(11) "Decrypted: "
Output for 7.0.4
Warning: openssl_decrypt(): IV passed is 32 bytes long which is longer than the 16 expected by selected cipher, truncating in /in/r1bfq on line 36 string(77) "Encrypted: 8fae47719ada48e53493e9e20de7aa4d::6b2661a72841fa1bae4aaefd708bb4c0" string(11) "Decrypted: "
Output for 7.0.3
Warning: openssl_decrypt(): IV passed is 32 bytes long which is longer than the 16 expected by selected cipher, truncating in /in/r1bfq on line 36 string(77) "Encrypted: 99fc751b54853042ab18372ececeb367::8e062b2274c09d7226545f617ede6e2a" string(11) "Decrypted: "
Output for 7.0.2
Warning: openssl_decrypt(): IV passed is 32 bytes long which is longer than the 16 expected by selected cipher, truncating in /in/r1bfq on line 36 string(77) "Encrypted: 0f19e9f5565f80b29d77bfadcc95080b::6ffc2c7b59bf03e084a2986ec517da7d" string(11) "Decrypted: "
Output for 7.0.1
Warning: openssl_decrypt(): IV passed is 32 bytes long which is longer than the 16 expected by selected cipher, truncating in /in/r1bfq on line 36 string(77) "Encrypted: d7e3c2c9ffb433791e6f4151de2f518f::af758db703c1e7390fd68c2b95f54cdc" string(11) "Decrypted: "
Output for 7.0.0
Warning: openssl_decrypt(): IV passed is 32 bytes long which is longer than the 16 expected by selected cipher, truncating in /in/r1bfq on line 36 string(77) "Encrypted: ca48aba1c8602d839dd610b8bc1b3771::1fcbd753259dd6771976b4537cab17a2" string(11) "Decrypted: "
Output for hhvm-3.17.3
Warning: IV passed is 32 bytes long which is longer than the 16 expected by selected cipher, truncating in /in/r1bfq on line 36 string(77) "Encrypted: 24b8a6077b16c047669088893a3d16cd::975fc1cf5330a7a022c4cee06431bc82" string(11) "Decrypted: "
Output for hhvm-3.15.4
Warning: IV passed is 32 bytes long which is longer than the 16 expected by selected cipher, truncating in /in/r1bfq on line 36 string(77) "Encrypted: 7bca89ca3ec28db2958f48f5b3b1d56c::1f97559974decdea0f452e903cde930e" string(11) "Decrypted: "
Output for hhvm-3.12.14
Warning: IV passed is 32 bytes long which is longer than the 16 expected by selected cipher, truncating in /in/r1bfq on line 36 string(77) "Encrypted: 2257e05b5ca49423935a484819fb5e50::47827cf0e899ffea31e504eeb67fb3ff" string(11) "Decrypted: "
Output for 5.6.30
Warning: openssl_decrypt(): IV passed is 32 bytes long which is longer than the 16 expected by selected cipher, truncating in /in/r1bfq on line 36 string(77) "Encrypted: 56807fc14aa2e76749031c8b61310722::7413ededed06ac5ba6ac9fe0557a682f" string(11) "Decrypted: "
Output for 5.6.29
Warning: openssl_decrypt(): IV passed is 32 bytes long which is longer than the 16 expected by selected cipher, truncating in /in/r1bfq on line 36 string(77) "Encrypted: e5cfa07c6f48d77efaa3970c6b950c22::785eb1608d9d83dd75f48c647fa324a6" string(11) "Decrypted: "
Output for 5.6.28
Warning: openssl_decrypt(): IV passed is 32 bytes long which is longer than the 16 expected by selected cipher, truncating in /in/r1bfq on line 36 string(77) "Encrypted: 4bff83b2afa0de6dc4eb87248d672c19::fd59ebef67340e9e27c1903d7f3485f7" string(11) "Decrypted: "
Output for 5.6.27
Warning: openssl_decrypt(): IV passed is 32 bytes long which is longer than the 16 expected by selected cipher, truncating in /in/r1bfq on line 36 string(77) "Encrypted: 24bea5ef7308073956d062302cdff024::cd987aa9a23fa19fbcd128a4ca36ef0c" string(11) "Decrypted: "
Output for 5.6.26
Warning: openssl_decrypt(): IV passed is 32 bytes long which is longer than the 16 expected by selected cipher, truncating in /in/r1bfq on line 36 string(77) "Encrypted: 366363dbf6e519b6007a6aff02e5d9b2::099a09ccdc1b8864f9f14e840cce583d" string(11) "Decrypted: "
Output for 5.6.25
Warning: openssl_decrypt(): IV passed is 32 bytes long which is longer than the 16 expected by selected cipher, truncating in /in/r1bfq on line 36 string(77) "Encrypted: f4efe440fbd944cd870fcc48327ac888::b31923766325a264793680a62520238e" string(11) "Decrypted: "
Output for 5.6.24
Warning: openssl_decrypt(): IV passed is 32 bytes long which is longer than the 16 expected by selected cipher, truncating in /in/r1bfq on line 36 string(77) "Encrypted: 42dd952a6d7618e91c4b562ceb1d81fe::3c3a3d16406017025d306c1a13c8362d" string(11) "Decrypted: "
Output for 5.6.23
Warning: openssl_decrypt(): IV passed is 32 bytes long which is longer than the 16 expected by selected cipher, truncating in /in/r1bfq on line 36 string(77) "Encrypted: 74bbd6c7069266e8b0a8ee95b80f1c85::3e4e793b566d3ee685b04c994e16e5c6" string(11) "Decrypted: "
Output for 5.6.22
Warning: openssl_decrypt(): IV passed is 32 bytes long which is longer than the 16 expected by selected cipher, truncating in /in/r1bfq on line 36 string(77) "Encrypted: 9e05821399e4034036e72b5aa1d82dce::459a748620e4fee1b3b8972d928a3094" string(11) "Decrypted: "
Output for 5.6.21
Warning: openssl_decrypt(): IV passed is 32 bytes long which is longer than the 16 expected by selected cipher, truncating in /in/r1bfq on line 36 string(77) "Encrypted: fc9780b2511a2293c30dd4d9ea5a0a46::904c868046e91d2bda0f3b456dea92bc" string(11) "Decrypted: "
Output for 5.6.20
Warning: openssl_decrypt(): IV passed is 32 bytes long which is longer than the 16 expected by selected cipher, truncating in /in/r1bfq on line 36 string(77) "Encrypted: 42bcb77b189656cdd3ce69dc6b15ccb9::b232d22452008b65b34c213fc428a803" string(11) "Decrypted: "
Output for 5.6.19
Warning: openssl_decrypt(): IV passed is 32 bytes long which is longer than the 16 expected by selected cipher, truncating in /in/r1bfq on line 36 string(77) "Encrypted: 12fbe69ddbd60fe1c424a3a1e32df91c::cda283f5b965cd8e2a278fed3bf6e446" string(11) "Decrypted: "
Output for 5.6.18
Warning: openssl_decrypt(): IV passed is 32 bytes long which is longer than the 16 expected by selected cipher, truncating in /in/r1bfq on line 36 string(77) "Encrypted: 910a36e2aa4c9c94b36dd679db7bbde0::81ff581ebf6a6732113a11e5877ddadc" string(11) "Decrypted: "
Output for 5.6.17
Warning: openssl_decrypt(): IV passed is 32 bytes long which is longer than the 16 expected by selected cipher, truncating in /in/r1bfq on line 36 string(77) "Encrypted: 5ff5b743b8d515c2895efc1df795f1b4::57be889b13d38ddcbdbfc6275685dc23" string(11) "Decrypted: "
Output for 5.6.16
Warning: openssl_decrypt(): IV passed is 32 bytes long which is longer than the 16 expected by selected cipher, truncating in /in/r1bfq on line 36 string(77) "Encrypted: c1b82296d92eaf15d462134280bfa63b::30abf95ace5380a7e051072e13e25d97" string(11) "Decrypted: "
Output for 5.6.15
Warning: openssl_decrypt(): IV passed is 32 bytes long which is longer than the 16 expected by selected cipher, truncating in /in/r1bfq on line 36 string(77) "Encrypted: 4f48d503ee5dc9794f86a3725389e35e::e720705fbabc5178257331628b0dd6c8" string(11) "Decrypted: "
Output for 5.6.14
Warning: openssl_decrypt(): IV passed is 32 bytes long which is longer than the 16 expected by selected cipher, truncating in /in/r1bfq on line 36 string(77) "Encrypted: 125aaffbef8d4e8d18b4f550934ef251::13885f71368050c97a9adc56a0624d12" string(11) "Decrypted: "
Output for 5.6.13
Warning: openssl_decrypt(): IV passed is 32 bytes long which is longer than the 16 expected by selected cipher, truncating in /in/r1bfq on line 36 string(77) "Encrypted: e4bd1fa72aab7f284fa0b00367a2dff8::34491489813184dfc1e183e23b2821ae" string(11) "Decrypted: "
Output for 5.6.12
Warning: openssl_decrypt(): IV passed is 32 bytes long which is longer than the 16 expected by selected cipher, truncating in /in/r1bfq on line 36 string(77) "Encrypted: 2cb217ee59d47172403b6c13f66a0071::e9c8cfb3986dbb25e91656e9406648b5" string(11) "Decrypted: "
Output for 5.6.11
Warning: openssl_decrypt(): IV passed is 32 bytes long which is longer than the 16 expected by selected cipher, truncating in /in/r1bfq on line 36 string(77) "Encrypted: f280015cdd5e8c7dff8888755c3790e0::3e6dc9e1db0de98a6d40167232261dc7" string(11) "Decrypted: "
Output for 5.6.10
Warning: openssl_decrypt(): IV passed is 32 bytes long which is longer than the 16 expected by selected cipher, truncating in /in/r1bfq on line 36 string(77) "Encrypted: ac3da4e52254676d0a4e142f2202338b::5cb0f979c9faa7fd19c559c4ce6fe00a" string(11) "Decrypted: "
Output for 5.6.9
Warning: openssl_decrypt(): IV passed is 32 bytes long which is longer than the 16 expected by selected cipher, truncating in /in/r1bfq on line 36 string(77) "Encrypted: 7001a3176514142d3930c184f0fcf09f::09a92148a5b84bf1c6cc12e9c6448fe9" string(11) "Decrypted: "
Output for 5.6.8
Warning: openssl_decrypt(): IV passed is 32 bytes long which is longer than the 16 expected by selected cipher, truncating in /in/r1bfq on line 36 string(77) "Encrypted: a24afb57d3008cb2954837a38b9b7826::55690dea894fbd299eed29d4caacc4f8" string(11) "Decrypted: "
Output for 5.6.7
Warning: openssl_decrypt(): IV passed is 32 bytes long which is longer than the 16 expected by selected cipher, truncating in /in/r1bfq on line 36 string(77) "Encrypted: a70a6e98854062c43bff1ae725e01f11::84dedb715028b52e8da1f94ad43fe804" string(11) "Decrypted: "
Output for 5.6.6
Warning: openssl_decrypt(): IV passed is 32 bytes long which is longer than the 16 expected by selected cipher, truncating in /in/r1bfq on line 36 string(77) "Encrypted: e5541961529127917b383a3cab3ff151::ee07d5c13ca30a0acde434ce1c8f3e3c" string(11) "Decrypted: "
Output for 5.6.5
Warning: openssl_decrypt(): IV passed is 32 bytes long which is longer than the 16 expected by selected cipher, truncating in /in/r1bfq on line 36 string(77) "Encrypted: 4ac14b263f785ca3eb3ccc80313ef97a::432eb754bff71f0e83747e5e37133392" string(11) "Decrypted: "
Output for 5.6.4
Warning: openssl_decrypt(): IV passed is 32 bytes long which is longer than the 16 expected by selected cipher, truncating in /in/r1bfq on line 36 string(77) "Encrypted: cea83609d8ca4a5216a3626d158c452c::5cb81aa0ec8830b109134dab9c239984" string(11) "Decrypted: "
Output for 5.6.3
Warning: openssl_decrypt(): IV passed is 32 bytes long which is longer than the 16 expected by selected cipher, truncating in /in/r1bfq on line 36 string(77) "Encrypted: fe5aef2c9407752a8ced8b6510ac6b84::fd078409a8db394b721f16f76cc96be2" string(11) "Decrypted: "
Output for 5.6.2
Warning: openssl_decrypt(): IV passed is 32 bytes long which is longer than the 16 expected by selected cipher, truncating in /in/r1bfq on line 36 string(77) "Encrypted: c15ed57c0e5a213f9f699096b9f99c69::7831f78e1d6945d5433621bf9f5b65ab" string(11) "Decrypted: "
Output for 5.6.1
Warning: openssl_decrypt(): IV passed is 32 bytes long which is longer than the 16 expected by selected cipher, truncating in /in/r1bfq on line 36 string(77) "Encrypted: 69f43ef78c8a7c5e987a485b350f9feb::3613c95a4c656d5037b2d74d228524a6" string(11) "Decrypted: "
Output for 5.6.0
Warning: openssl_decrypt(): IV passed is 32 bytes long which is longer than the 16 expected by selected cipher, truncating in /in/r1bfq on line 36 string(77) "Encrypted: 75e66d3483a32d91fd94a77ad8295c2a::04dfac8d68898faf1373bcee139cdce6" string(11) "Decrypted: "