3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $key = 'password to (en/de)cryptg'; $string = ' string to be encryptedg '; // 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/72qoD:8 Stack trace: #0 {main} thrown in /in/72qoD on line 8
Process exited with code 255.
Output for 7.0.5
Encrypted: string(64) "4S99j39dziJnSHGLy1vC+OHnq98CZV9b8U/DxYVJ2zJeX5V7dDVqluCWtRk7fJAv" Decrypted: string(25) " string to be encryptedg "
Output for 7.0.4
Encrypted: string(64) "iBRJMREAqFS3lZe1CIi44x7MZSSMlf/d5ejWJEhH1tSPKJ54ll12nqaHypCSqbV7" Decrypted: string(25) " string to be encryptedg "
Output for 7.0.3
Encrypted: string(64) "9YyyXdRvvzFPu+tnaQVVnN8tSCRaxkkVkt5PwGwlEzgzm1fxVPth19FZAtf+FQTl" Decrypted: string(25) " string to be encryptedg "
Output for 7.0.2
Encrypted: string(64) "rmy6ZYChQD0hSS2h1VLEmwG0mOHYDd4v8IeYofsNJhG2Namrz1ICkUMNn/s5qKeY" Decrypted: string(25) " string to be encryptedg "
Output for 7.0.1
Encrypted: string(64) "yxjotBlC11OlI4o5+KuK8Ta2VHzKjl3IutVPD/T+IfK7zau6k03LaysPxVSba9Cu" Decrypted: string(25) " string to be encryptedg "
Output for 7.0.0
Encrypted: string(64) "G0Ivs7x8zGclz6jC4u79RbX66+EH9C6WJDL6TrazcL0CU8gYlCiEAuJKaN1DmSTE" Decrypted: string(25) " string to be encryptedg "
Output for 5.3.21 - 5.3.29, 5.5.35, 5.6.21
Fatal error: Call to undefined function mcrypt_create_iv() in /in/72qoD on line 8
Process exited with code 255.
Output for 5.6.20
Encrypted: string(64) "9klzv+kbEBNOo6Uqiwf8AtSf4F82rjdpIZ0r4E7n1eGswsKDZVNRrH5qM8xe+0Y5" Decrypted: string(25) " string to be encryptedg "
Output for 5.6.19
Encrypted: string(64) "a0AUTq2uPduPjny645A0F8GMU+N67LklpNaXmhPYpXZP8TmtH8B12SrTeP2XP6Xi" Decrypted: string(25) " string to be encryptedg "
Output for 5.6.18
Encrypted: string(64) "w8SFw/7lZRM+VW/+Wzb+7D38PIkEFWPvOe2bflSXRuyO2WFhDlmTWAOvGHYmtWei" Decrypted: string(25) " string to be encryptedg "
Output for 5.6.17
Encrypted: string(64) "9XxpMqDzfiCnnGBLPyRoJ3kCJsYZ8rA7+AtHv+7fDqmZYdDo/X9fmJxZuB8wkooa" Decrypted: string(25) " string to be encryptedg "
Output for 5.6.16
Encrypted: string(64) "k/em108t68+T8mDTCzaN2pBWlP5hIyYpwB6194WwXte+OU1pjnaSftk2UABTWuLv" Decrypted: string(25) " string to be encryptedg "
Output for 5.6.15
Encrypted: string(64) "YABJRe89u5NKJLC0BKmeNx+zeBfmC9W/TutEJEPWYtw81jcjvXUb6jFS2FNP2L6K" Decrypted: string(25) " string to be encryptedg "
Output for 5.6.14
Encrypted: string(64) "hMvpIgDFJySO6c1XVuZpxfqg/NfG6mkj0EYigclA5QKxqET3ArcddLh5ggxGxA97" Decrypted: string(25) " string to be encryptedg "
Output for 5.6.13
Encrypted: string(64) "dYwZ9vvWy3PK41wYgrbjM5grQSVti4tqMYq9XgW7AuWZTv+wNTfvFroHHUb2VVpv" Decrypted: string(25) " string to be encryptedg "
Output for 5.6.12
Encrypted: string(64) "NHd3m7IJESzblYzhyFrJpZlxq/hHTJdqcfRuNEhJGZUk6G+brnZhhi5ZzVSXYLGz" Decrypted: string(25) " string to be encryptedg "
Output for 5.6.11
Encrypted: string(64) "SV+eHWUME7bnfvTHL5Qsr+p29ao5O0okJ/PheQWGJJmMdZFIdGzwNlQY8LVLCU9V" Decrypted: string(25) " string to be encryptedg "
Output for 5.6.10
Encrypted: string(64) "BarxRha+ALt28Ek0KtKaPZhbpkEHTNdZOAtMTZdCExELzpwdgDgiofT6wnhx3ZD7" Decrypted: string(25) " string to be encryptedg "
Output for 5.6.9
Encrypted: string(64) "LJhlJmL2HL1rU4XeoKNsif/GKH1sDB232FyOunw1Hv7IHimUHOigORa1RLFyJXbT" Decrypted: string(25) " string to be encryptedg "
Output for 5.6.8
Encrypted: string(64) "tkaT0N2psW6PWeBRuScUjWbFO6FMCxVniB5drvXiT9dE2hw3ftIL6/uMP6Pg21Ub" Decrypted: string(25) " string to be encryptedg "
Output for 5.5.34
Encrypted: string(64) "c4d7/6+yoXh66DGAfJt2iseIKxp83fyKo811FqP+o4jX1AhmkTI3IdwOoH/pItBp" Decrypted: string(25) " string to be encryptedg "
Output for 5.5.33
Encrypted: string(64) "26hZs1kine18RcqwHd/UCPWRi/gL2a+4OLy6n+0fSzUm2Jr8Imqe9M7hYv/16exw" Decrypted: string(25) " string to be encryptedg "
Output for 5.5.32
Encrypted: string(64) "ONHYOeqEUlIviGDMMnkvKH4skQbSB4DJvRzPA2MtDq4YWPFtKd2/kLx1vE2quWFo" Decrypted: string(25) " string to be encryptedg "
Output for 5.5.31
Encrypted: string(64) "dkvfFJx6tMWQ1ssq5HWNK75gNH8gvTV9dfvlK863POAUdKTmGG5BrUJ9GzGKDth2" Decrypted: string(25) " string to be encryptedg "
Output for 5.5.30
Encrypted: string(64) "skxFy1tcHlXZU6UNrbsH0Ozjjn6sy29gLyplrnLJX/NeCzCmc6//vt5Ne1kVqynV" Decrypted: string(25) " string to be encryptedg "
Output for 5.5.29
Encrypted: string(64) "E6trqJRlGLq2XpJBqPdyOUsY6ur3WXRvSdUA876Srr/APuPVNaztNJTSkw53HG6z" Decrypted: string(25) " string to be encryptedg "
Output for 5.5.28
Encrypted: string(64) "g1jxl5VQP9n/RDiDk2MegC6Qyo0uuSPnU1KZEgn0Kx6QImWYrKxuwpVLyRvlxAo+" Decrypted: string(25) " string to be encryptedg "
Output for 5.5.27
Encrypted: string(64) "JzoerleoAp/y54h5OL9woIjM2S43pZggyjAhXf0JqbNLdL28o3d/sI35Q3YNEU3q" Decrypted: string(25) " string to be encryptedg "
Output for 5.5.26
Encrypted: string(64) "vLshzOJgr5iBivCNyaROcU2M6q+CeWUtwGWchkD9sx1zB2ucErtTFu6UNsGLs1b+" Decrypted: string(25) " string to be encryptedg "
Output for 5.5.25
Encrypted: string(64) "nJxU7BOF5iPqKhBjrt6mbW+rgP47/uKF8Qa0cMc+isYXhV9w8v0kfEp9YbKIH4Pe" Decrypted: string(25) " string to be encryptedg "
Output for 5.5.24
Encrypted: string(64) "qJ8l5+1o5DGmQQms/FxHfacOnzP/q2fD+kNjoNwDcd3xsNQwRnqElDSzVQ59xW9O" Decrypted: string(25) " string to be encryptedg "
Output for 5.4.45
Encrypted: string(64) "Ys6Ed6nLLwrIsN/whlEg+c/pFItvfwDQr83bJq+RCqb95NS2JPr3JXTBHoGMl5+w" Decrypted: string(25) " string to be encryptedg "
Output for 5.4.44
Encrypted: string(64) "xcShjQj93UBi4RiNfzE7Xx6Wjbp+8n+Jfy1s+KObJXJ0t3U4flouvpad9MqA1sYO" Decrypted: string(25) " string to be encryptedg "
Output for 5.4.43
Encrypted: string(64) "ZadaaE2JzIjSpy/bwysCVoP8sHad9AU7/D9A522JqX5reVv6XsvcWyepT2pUQana" Decrypted: string(25) " string to be encryptedg "
Output for 5.4.42
Encrypted: string(64) "AyR0Tr6fn4JxoXxa3MRxVoFRNWY8v5thfMwrAvyXo8zADTHEq1VOoDPqtmmhZnTc" Decrypted: string(25) " string to be encryptedg "
Output for 5.4.41
Encrypted: string(64) "9rivkI1GE5gic5ysJzWtRntbhdRZmvaW8LdL/nQNV8ZvhyqWitNB2N+GwMCthnJC" Decrypted: string(25) " string to be encryptedg "
Output for 5.4.40
Encrypted: string(64) "xLUf5ea6rneMTIy9ujvfIbpDDsfSUv/sNkPytHXMPGcYg5TyuBKhw7EhNych4gTd" Decrypted: string(25) " string to be encryptedg "
Output for 5.4.39
Encrypted: string(64) "1wIPJjCPNlw0BBDVHArmyrlZ2pa2c0PFznXWkXYZYOHhJS6VWExT6/1bbCo2/uId" Decrypted: string(25) " string to be encryptedg "
Output for 5.4.38
Encrypted: string(64) "5zvF04dtF+thIlv/DRnlS3wURJCM/2eqOq2N1VETmb5C/vFZ5Evx95ZGGjJWEKxp" Decrypted: string(25) " string to be encryptedg "
Output for 5.4.37
Encrypted: string(64) "cn60GjhBfrFQObMLjuu9OCNdcQPT9F2nxJokYSnpzUdleq9/nNmP7MkPGMJQ3wY8" Decrypted: string(25) " string to be encryptedg "
Output for 5.4.36
Encrypted: string(64) "3G5sUydmNd0wL6BUgKofxGUvL5PIL/Jj6s4F56EbTB4bXIdpgCwvYjKatzZpCobF" Decrypted: string(25) " string to be encryptedg "
Output for 5.4.35
Encrypted: string(64) "ka7A4QdNAuehsqngyhxtrMeawYap41Yr3n1QsmXvC7cuxN1iXUgZRbkcorS455ah" Decrypted: string(25) " string to be encryptedg "
Output for 5.4.34
Encrypted: string(64) "6HQwaroYyIH0hyXB2dh+7BFnJk1AeTQ7WKQHiATvJCGievTFckPba1QqVOvbx4yg" Decrypted: string(25) " string to be encryptedg "
Output for 5.4.32
Encrypted: string(64) "/nKZR1UUxJHKhbg3Z4M10+IJE172PrrgvLQcH2XUhbenlpjxm2GrlNApvcdXuBAR" Decrypted: string(25) " string to be encryptedg "
Output for 5.4.31
Encrypted: string(64) "KQCdJLf/vZa73ZL60urIdNAvdTBw6HsEga6AQMXVqqHSK6RCMLS9utaA0+/pJ8D2" Decrypted: string(25) " string to be encryptedg "
Output for 5.4.30
Encrypted: string(64) "KOulDss9PnR2tmBDf70Ku0BlIwPh/ILDaVPDGMfKK77eqqmmNTewPkTBprr1H5Xg" Decrypted: string(25) " string to be encryptedg "
Output for 5.4.29
Encrypted: string(64) "C7YCCCUABsCTd71JjbqdBsXI408W5BK7Qdroya7xl9KeNRKP2eDnMb0VwSr7GZmy" Decrypted: string(25) " string to be encryptedg "
Output for 5.4.28
Encrypted: string(64) "lF0bXHAZ5wq/jTJFd4f15zZSQfSt+cFGzbnlQwPH0k8TrwR+8o6exbmtnm1sb0O0" Decrypted: string(25) " string to be encryptedg "
Output for 5.4.27
Encrypted: string(64) "Xqo40M/BttWjaYkaXk6bQfiwgdRgRoDxz62/6/cWW1F/TAkY5t1blbv5izVOlHoJ" Decrypted: string(25) " string to be encryptedg "
Output for 5.4.26
Encrypted: string(64) "rsvTPTFLcLKysPXCS3FHPZ/wHqoVyNZCgjNCo3i175GJ1y8WopfwU/Bu+oNPkrIx" Decrypted: string(25) " string to be encryptedg "
Output for 5.4.25
Encrypted: string(64) "NuT1zPRpQddxUWjY6IkOmXaz7HCWkIGmPbups5JezeuOm53j2BQ6OuVTXRiInahV" Decrypted: string(25) " string to be encryptedg "
Output for 5.4.24
Encrypted: string(64) "edTYP2kEyGQOzHaQiGwZYX9Rsg73jUdWFSqxv1u/wOygYe5LqyHy1Q8hCiONM3R2" Decrypted: string(25) " string to be encryptedg "
Output for 5.4.23
Encrypted: string(64) "StJvKhu/MgzTKaHnQK9rIt+3+uBKniWG3f+KKAIYS6Xl0naaeggKVWPL19G338Vg" Decrypted: string(25) " string to be encryptedg "
Output for 5.4.22
Encrypted: string(64) "qk4hexhB5dp5+FyGYeNsukvOlsmhAvOkV8EqIaeq1jQwB+O7BJ78W9dFd/C3FV7U" Decrypted: string(25) " string to be encryptedg "
Output for 5.4.21
Encrypted: string(64) "3OZGvtGC3teGEolDvh7NUDyBlJWjUmq/fjXN2p/wSulODb5JqO9sf2nyJKfGzSj3" Decrypted: string(25) " string to be encryptedg "
Output for 5.4.20
Encrypted: string(64) "aYeQ6islismyBZFnvrANtbOicUGM+5Jslr2WNh/KpNblYl+kd6csuvKV7OALMKzq" Decrypted: string(25) " string to be encryptedg "
Output for 5.4.19
Encrypted: string(64) "eIq3af/xMtqfkexOwX7OG5jeLLwrwblXbIv0kIezbmSH1MoTAnnci0uk8J67ZYfA" Decrypted: string(25) " string to be encryptedg "
Output for 5.4.18
Encrypted: string(64) "qYmrI2p8h6wepGZZSWM20dvB0f4G1AkLTBsx2kw53p2RunAyEq93HYOid7lgr2nW" Decrypted: string(25) " string to be encryptedg "
Output for 5.4.17
Encrypted: string(64) "ON+XqufBPDAyqpAjHQDxAyOZm75WDvLClcO73QP2QOzbPR+cneQMYBJh/8y9evlh" Decrypted: string(25) " string to be encryptedg "
Output for 5.4.16
Encrypted: string(64) "ymk63UO4iRQUsCK9x0G0TRUr3T+AZ3U2LIi0TdDNWuPanOm2Tu485HXbSKmy73++" Decrypted: string(25) " string to be encryptedg "
Output for 5.4.15
Encrypted: string(64) "RIdVoyTXtYSQ7zTRSEMiZsxOX2LQJT+eU7fYwIlngi9PTc9fcn1O8sxMkwvUT9m5" Decrypted: string(25) " string to be encryptedg "
Output for 5.4.14
Encrypted: string(64) "uqGf3AUEVXs8LYT9aCoQvQYDAIW5yh/BrbzmSBR73wqRKHKbvZDIpHSufLx67K4F" Decrypted: string(25) " string to be encryptedg "
Output for 5.4.13
Encrypted: string(64) "Nmvprbz/YedkEqJdCENOcdF7QBPfFVLfbXF4/J/0qqxuIpAGIt5jGag6V+U5FnJd" Decrypted: string(25) " string to be encryptedg "
Output for 5.4.12
Encrypted: string(64) "n60S3LvtKOFg+NukbBVjgMPMr9m0RtS46veWugmh91B/hvfwQs9NbGIzzjm6z4I9" Decrypted: string(25) " string to be encryptedg "
Output for 5.4.11
Encrypted: string(64) "epoUCiD9OLyCZKcjZiCpWfdRtGg9cWSqpFgDx6qaOOfqZsImLO4LikhAvZ+hokyS" Decrypted: string(25) " string to be encryptedg "