3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $key = '1234'; $string = 'MMPH12-0017/2015-11-11/0'; // note the spaces $iv = mcrypt_create_iv( mcrypt_get_iv_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_CBC), MCRYPT_DEV_URANDOM ); $encrypted = base64_encode( $iv . mcrypt_encrypt( MCRYPT_RIJNDAEL_128, hash('sha256', $key, true), $string, MCRYPT_MODE_CBC, $iv ) ); $data = base64_decode($encrypted); $iv = substr($data, 0, mcrypt_get_iv_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_CBC)); $decrypted = rtrim( mcrypt_decrypt( MCRYPT_RIJNDAEL_128, hash('sha256', $key, true), substr($data, mcrypt_get_iv_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_CBC)), MCRYPT_MODE_CBC, $iv ), "\0" ); echo 'Encrypted:' . "\n"; var_dump($encrypted); echo "\n"; echo 'Decrypted:' . "\n"; var_dump($decrypted);
based on CJfSn
Output for 7.0.6 - 7.2.0
Fatal error: Uncaught Error: Call to undefined function mcrypt_create_iv() in /in/Idk3L:8 Stack trace: #0 {main} thrown in /in/Idk3L on line 8
Process exited with code 255.
Output for 7.0.5
Encrypted: string(64) "QkQBNTdelYN0iRjH57DoSF2v8pwISpiL1g65gdMYKL6afuOSC0f9kSUnmCJQlucC" Decrypted: string(24) "MMPH12-0017/2015-11-11/0"
Output for 7.0.4
Encrypted: string(64) "ucA6t/LTPhDQqdIXoXUPLCzi63afAVZk3FjAJXIcOQcWAZ+Tzv2TNfUjz2R5mZy9" Decrypted: string(24) "MMPH12-0017/2015-11-11/0"
Output for 7.0.3
Encrypted: string(64) "kxbSvwytWOMpzjNI6NX8AN0gkQXTrajSgrVqWUYjmk45fMnhvjVTld+zJFLRpoLc" Decrypted: string(24) "MMPH12-0017/2015-11-11/0"
Output for 7.0.2
Encrypted: string(64) "TAkw3HilqJSIPoaaeg6+3tfOq3iqZ63pOntmT8l7BvVcX3cEDJlHjVTc1PuteAyK" Decrypted: string(24) "MMPH12-0017/2015-11-11/0"
Output for 7.0.1
Encrypted: string(64) "2VUNgjVSU1P2VoDer0RgbHtKnqE65jNPcJDXgTGzbbIxMVV7RO2fDFyJHEEpdYLB" Decrypted: string(24) "MMPH12-0017/2015-11-11/0"
Output for 7.0.0
Encrypted: string(64) "+0mCdD25yIgUk+Wr/Aqv+eeJffeDKdY/6Adx6MlEHWtqjQVpENxcmOy2FjmKBzrb" Decrypted: string(24) "MMPH12-0017/2015-11-11/0"
Output for 5.3.20 - 5.3.29, 5.5.35, 5.6.21 - 5.6.28
Fatal error: Call to undefined function mcrypt_create_iv() in /in/Idk3L on line 8
Process exited with code 255.
Output for 5.6.20
Encrypted: string(64) "jKgDukX3dGOCjZS8QundhleFbaibPKUiuqkoF7cD2vp7adhuCP20a1OsuZzbm3oR" Decrypted: string(24) "MMPH12-0017/2015-11-11/0"
Output for 5.6.19
Encrypted: string(64) "LDFe6QtHx4V9Fh6GSoBjU65qxoCqMi0i8X2UqD/CFbllRfgxXGsmbXrFd9rUkoy6" Decrypted: string(24) "MMPH12-0017/2015-11-11/0"
Output for 5.6.18
Encrypted: string(64) "Lr4zoP8eoaEm+Mho6jBSKUPZ48lNopTI1jSP9d0fiGYqgc+ZPBnGrMizge6JylTT" Decrypted: string(24) "MMPH12-0017/2015-11-11/0"
Output for 5.6.17
Encrypted: string(64) "gnbOtXUfNbVfwee3S8CT6csa0CnEhfejK48ziUKqIsqWT9K98KM1GyCpwgngp4li" Decrypted: string(24) "MMPH12-0017/2015-11-11/0"
Output for 5.6.16
Encrypted: string(64) "CQHmCuqVWnzDb154fsWgG0wnwZObj25/G0wzYyR18RhM1AgXTLQp48GWkdPZzM3L" Decrypted: string(24) "MMPH12-0017/2015-11-11/0"
Output for 5.6.15
Encrypted: string(64) "p6D8Ex81Klbfkj0a/DEFXFL6Z3GpcYgLBPtkkBICuOGnw7VG57m0pp3zpzSxflqy" Decrypted: string(24) "MMPH12-0017/2015-11-11/0"
Output for 5.6.14
Encrypted: string(64) "YP5bXwK2kUYCvRG3vVYS4qUd1vrlnpOppYXbAlK82mO88+5htOJJJP1V9ZJoeITa" Decrypted: string(24) "MMPH12-0017/2015-11-11/0"
Output for 5.6.13
Encrypted: string(64) "g3fsaEXXzZTMP0aW1QDe+u2uZLDdMaWcr1+t/8jmNt1h+Q0ULfD9Bmenyo9RAEjy" Decrypted: string(24) "MMPH12-0017/2015-11-11/0"
Output for 5.6.12
Encrypted: string(64) "R8iQWlw5iPlYxAJNwfypsSGGYt4yHqg0FdCcJyr/RHjgn8+6YulgrCrOXgoCpJ1p" Decrypted: string(24) "MMPH12-0017/2015-11-11/0"
Output for 5.6.11
Encrypted: string(64) "4bc4Jz/RyH2rgflywOOJ2r7R4Wo9g50RwAHeg7eoHnNr2ylgVEuERA18VEtJROTp" Decrypted: string(24) "MMPH12-0017/2015-11-11/0"
Output for 5.6.10
Encrypted: string(64) "3vVX+JiZVaJcH7AlM2mTRT/+qjJoREoZNgE+xLgeurhWdaALYtRXAfvtFeCO9bPb" Decrypted: string(24) "MMPH12-0017/2015-11-11/0"
Output for 5.6.9
Encrypted: string(64) "Y27adLXpiN9Je27Czvvi1qIS/zPFRUyxzd+NO20tq2j1bZcMPbrgpUXLaEX4PRLX" Decrypted: string(24) "MMPH12-0017/2015-11-11/0"
Output for 5.6.8
Encrypted: string(64) "ixUgUOTFCd1djfQG2fBBLhXJp3/b7dl2Ex6NaqSPaTz7/vptrm0gPlbH4uCcDNK9" Decrypted: string(24) "MMPH12-0017/2015-11-11/0"
Output for 5.5.34
Encrypted: string(64) "PBIfBJbNJz7uslkZUNf2rgJScTSwjlmjm0md3d3DnHFj21bgQIRLlLkdWHVgq7B3" Decrypted: string(24) "MMPH12-0017/2015-11-11/0"
Output for 5.5.33
Encrypted: string(64) "q8hXY/mfyHEbx2qI3KsBStGMFEUdfn4Y+7QmOuMA2/emIT7VT6FYCGRRUrWvLiL9" Decrypted: string(24) "MMPH12-0017/2015-11-11/0"
Output for 5.5.32
Encrypted: string(64) "FvNDXMC1Ma6lRbgSQ6o9LZo/TScX/aEQnP5RlgUUfrxiyXLQeEwVP8Y+KAoNndSE" Decrypted: string(24) "MMPH12-0017/2015-11-11/0"
Output for 5.5.31
Encrypted: string(64) "IOevhqWL7AAIVk2UvLAizbPeqPsPbUppQgkUnfcLnH/nSiaS8EHua3gQ+HxAxZ90" Decrypted: string(24) "MMPH12-0017/2015-11-11/0"
Output for 5.5.30
Encrypted: string(64) "g2mTXGXnpnQgid1P0W7SV2Km1NPxi5Ju/lDN8MHNiEsTe73We5YuEZbaatXIePCK" Decrypted: string(24) "MMPH12-0017/2015-11-11/0"
Output for 5.5.29
Encrypted: string(64) "Jz/vx34KIm6UWxpQ8ocPQpz7JCJWkmmiqx/rR2ShiYCvKoZu3MEExMYXfVAkHp1L" Decrypted: string(24) "MMPH12-0017/2015-11-11/0"
Output for 5.5.28
Encrypted: string(64) "6Gg/i+40xbnrqaiqEZaEzXu9rDwLg02S2rOlumMYOnuM0pVaWi66tGuev5aCeHQE" Decrypted: string(24) "MMPH12-0017/2015-11-11/0"
Output for 5.5.27
Encrypted: string(64) "duBPdFuwZc8olxxpMQFwHMjoCJe6ZmtjmJeWicaIFGhMPzqet19xwfhWVbE4MAoB" Decrypted: string(24) "MMPH12-0017/2015-11-11/0"
Output for 5.5.26
Encrypted: string(64) "zAzp/g86hMn3j/C0coR2fMhKNWZ3Nuiw3Uy5WKmkbOn8Y9jL9zgTzJLgfgRaQM5z" Decrypted: string(24) "MMPH12-0017/2015-11-11/0"
Output for 5.5.25
Encrypted: string(64) "CmYgV7cGiFeWbMUpfMv+Bay3KWssfetFwpLEOLI7MFvCIe7EGnD5PDpXD0aU9ysM" Decrypted: string(24) "MMPH12-0017/2015-11-11/0"
Output for 5.5.24
Encrypted: string(64) "p/dDAimNpvjp7uvRVnno/H2GsAJjzl4L+XVxKDeKrzydm1xmyFCk8slOXk6WK6/5" Decrypted: string(24) "MMPH12-0017/2015-11-11/0"
Output for 5.4.45
Encrypted: string(64) "8HUxN5TUxsyy8C9qyFoJlnPreK/Yz+pcwGrgJ7GjpcRmoRZjCKw1yu7qWFudxvpL" Decrypted: string(24) "MMPH12-0017/2015-11-11/0"
Output for 5.4.44
Encrypted: string(64) "SEDBdeuDXMr6F/CRp8KHfMbLBeifJjg9oIEwg66+15QZotZYQFN2L1jbkmgrOvZr" Decrypted: string(24) "MMPH12-0017/2015-11-11/0"
Output for 5.4.43
Encrypted: string(64) "iPiCUbaLAlXvnASUKk90hB383ofMWcLDOJr4WzwhSD+7LAMTPtj+Q0TMYcr53PrQ" Decrypted: string(24) "MMPH12-0017/2015-11-11/0"
Output for 5.4.42
Encrypted: string(64) "z+WUWtq3+meAFOyfgt9HE5aKNn+GyqJ/V027x8mRpUuwv0x6mA4J9Qc4izc7zCWJ" Decrypted: string(24) "MMPH12-0017/2015-11-11/0"
Output for 5.4.41
Encrypted: string(64) "bJn9gEANx073H2MKwGfTGkKCCHjxiyQeP92+dHizz+dC/GvkXlJcU/FgpyOMcQQf" Decrypted: string(24) "MMPH12-0017/2015-11-11/0"
Output for 5.4.40
Encrypted: string(64) "ycd6Xo6EnV4x4Ib3SImk8ixzN7Q1/DNBp+haZFcHAhMvq/YhXyNhhCI9iuOX9hjp" Decrypted: string(24) "MMPH12-0017/2015-11-11/0"
Output for 5.4.39
Encrypted: string(64) "ILw8dqmKc6Kj7lhvuZFVoIVe0+z+xxtYlrhTZA9GKb+AOB9km5EiPY81yC1aMaVh" Decrypted: string(24) "MMPH12-0017/2015-11-11/0"
Output for 5.4.38
Encrypted: string(64) "GO9srUjPTluXbSSuinoyd4IjTvtg9Y2VWhtlG9y1PbuLdrqk8e7savqmzuEvbLnL" Decrypted: string(24) "MMPH12-0017/2015-11-11/0"
Output for 5.4.37
Encrypted: string(64) "btLOdtYg3XcWUtiBa558YQAaLd5wuVujZPofHYnOmb0XW/BkfMAxyxd2JWI9++UB" Decrypted: string(24) "MMPH12-0017/2015-11-11/0"
Output for 5.4.36
Encrypted: string(64) "azjSlkSKAdkg3E7O38m4wwJeI/zWMRrrIwW7OyQqmz6a+dGBuXoFCbcEHxwtpGLH" Decrypted: string(24) "MMPH12-0017/2015-11-11/0"
Output for 5.4.35
Encrypted: string(64) "ZxMSv1jye2agrCmSQlzyMRJSE8OMthOblnuPYV4X38TY4sJmcWQpJ6++teeo4smx" Decrypted: string(24) "MMPH12-0017/2015-11-11/0"
Output for 5.4.34
Encrypted: string(64) "tzY/fDlM7S+AGmy4nqK6kuzvDUlKIccAY6JXzWLYssRRIGbW/ZzF17g36DO4ncRE" Decrypted: string(24) "MMPH12-0017/2015-11-11/0"
Output for 5.4.32
Encrypted: string(64) "eTRCcmJBB49LxzUKMpaMtWmAAFPye3OPeilFtQ9TKcQrYTnKSENrK0FOzuOppAdo" Decrypted: string(24) "MMPH12-0017/2015-11-11/0"
Output for 5.4.31
Encrypted: string(64) "YxHgetyEG5o29l6wyRehvSxvnRS4H0A6UrUT1rj4pRLL7a2FAhfUrH9LCx8oNG7d" Decrypted: string(24) "MMPH12-0017/2015-11-11/0"
Output for 5.4.30
Encrypted: string(64) "MgsAoRQYMLqL0cCNDzKq9Bzp4xgzGq3d4jKLSra1vnUjhVPS+2E1jH0FvC1lqXz6" Decrypted: string(24) "MMPH12-0017/2015-11-11/0"
Output for 5.4.29
Encrypted: string(64) "jT5eJYzTMJJ/8D2tXZAM+lFpnzz9h3rO2x4H4F5QGH+8NlKZkOZInKBIP5iQzwDK" Decrypted: string(24) "MMPH12-0017/2015-11-11/0"
Output for 5.4.28
Encrypted: string(64) "qa9y8LXQPqhzRoa+zdRMHdIl0P3AygOvsnw0GTV0dp+VxRdZxTx+EX1/Jl5DW5RH" Decrypted: string(24) "MMPH12-0017/2015-11-11/0"
Output for 5.4.27
Encrypted: string(64) "u3+Vtqyv2m7zC10ujsxyhdon/itUPQClh8i39UCY4uy+gmFwxwMj/ylKm31CESwh" Decrypted: string(24) "MMPH12-0017/2015-11-11/0"
Output for 5.4.26
Encrypted: string(64) "ta9Fy+4RTd7HokiTemYv/wAJtZCZZbM1SvERkG+IkEdNlD+q8FGABlr/rrAWhCke" Decrypted: string(24) "MMPH12-0017/2015-11-11/0"
Output for 5.4.25
Encrypted: string(64) "k7roewr7YQTJpdeHIy50aOsEZ198rGd+P0zaLR5KjfQGawgejqXfl9TqZ38zKR16" Decrypted: string(24) "MMPH12-0017/2015-11-11/0"
Output for 5.4.24
Encrypted: string(64) "9tTyayuoOHbWh1ydL6S5cLZlYfcDSkiGOmanEYBVBRRsa4nN6EmctNuool88QfjC" Decrypted: string(24) "MMPH12-0017/2015-11-11/0"
Output for 5.4.23
Encrypted: string(64) "ZZ4wdoa2L+YiIQmB/EA8+r028yWaPTByz0Ek+mLsvY+gNsD+xZ4afBUk9ltqQtXr" Decrypted: string(24) "MMPH12-0017/2015-11-11/0"
Output for 5.4.22
Encrypted: string(64) "EJSW6YDbNtnZqP7cUtxBkxzb2mMhKvofJFGKWaT/UsCa6fC3gjx935dJr62aVtx3" Decrypted: string(24) "MMPH12-0017/2015-11-11/0"
Output for 5.4.21
Encrypted: string(64) "vFfUzJoAF9cpllpSL++AnAzmt9hxGh2WnbvI4AD/YwxONXD+KBI+Wgo6SQGbKoe5" Decrypted: string(24) "MMPH12-0017/2015-11-11/0"
Output for 5.4.20
Encrypted: string(64) "I7YVcda0/mMbxA85NwkeoVTWVok2/MineMHgj+Fo5KEdiavvwdDeobZORPzYqqU3" Decrypted: string(24) "MMPH12-0017/2015-11-11/0"
Output for 5.4.19
Encrypted: string(64) "V1vmOoUvroCUDyzh5unvHA09avxjgG+XNfBflyRKJYnz8etnbGs8IXBWHS9IoU/c" Decrypted: string(24) "MMPH12-0017/2015-11-11/0"
Output for 5.4.18
Encrypted: string(64) "7RPRYnDu9IbOya8l7hHHxhuABfQy3s5uMTepRLGtTo/rU18z4KSRZIB9ykMy2pZd" Decrypted: string(24) "MMPH12-0017/2015-11-11/0"
Output for 5.4.17
Encrypted: string(64) "eJCjI4SkRkvDS8/U2Qk1BoYs7pyUgE0Z1k5gQfUu4lJveDNB8reJr/zOaKXhQ1Hi" Decrypted: string(24) "MMPH12-0017/2015-11-11/0"
Output for 5.4.16
Encrypted: string(64) "fiSfCWWGoWG8bbartRFZJ7kRuBN4CfOsuA0hkp36XT8JDLZG/HfVg8W8h5praSzU" Decrypted: string(24) "MMPH12-0017/2015-11-11/0"
Output for 5.4.15
Encrypted: string(64) "ygYB1rhxUkvpxSshsm3UxhiqV6DXHxeuAZr2bMbI3OmRDm8cG4JJFwHc787MVzTu" Decrypted: string(24) "MMPH12-0017/2015-11-11/0"
Output for 5.4.14
Encrypted: string(64) "+PDjX7LRsVy5KSHAlio+qGjcvxaezhWPytxtBFhlPaSW1mNcCDCayWbD36d+SCeq" Decrypted: string(24) "MMPH12-0017/2015-11-11/0"
Output for 5.4.13
Encrypted: string(64) "vuRXWTPGuR19VbxyWkF8Vf6DqmbN0NPIrh3g1MCyPp6g6ImK+vtyvjekCd0SE+Rr" Decrypted: string(24) "MMPH12-0017/2015-11-11/0"
Output for 5.4.12
Encrypted: string(64) "D3fCGZts5xIv4fvNQoEveplTkTxnMWYInqZ33mTdaw3pSyAolc6vYsjigMjdUKmX" Decrypted: string(24) "MMPH12-0017/2015-11-11/0"
Output for 5.4.11
Encrypted: string(64) "bY6lNEAifMrCX4vO95VSGQaPeHdKwx2Vb2nxLKv1HQBYBtsW0bNwod0aHfpv2mO8" Decrypted: string(24) "MMPH12-0017/2015-11-11/0"
Output for 5.4.10
Encrypted: string(64) "ZpG4ofQ4D4YKVghpJWz1RFOhXGWvtSykMwb8eADfuUTEW/yi91tkRNIr+41R/EaO" Decrypted: string(24) "MMPH12-0017/2015-11-11/0"