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($s, "w+2#)1FP&LIPTL2<8I2");
based on 9EsRK
Output for 7.0.6 - 7.2.0
Fatal error: Uncaught Error: Call to undefined function mcrypt_get_iv_size() in /in/KHqWL:7 Stack trace: #0 /in/KHqWL(28): CRYPT->encrypt('test ...', 'w+2#)1FP&LIPTL2...') #1 {main} thrown in /in/KHqWL 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/KHqWL on line 9 32eg0oSNkocX0pRp6H1aUQ==
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/KHqWL on line 9 Ww008FuSEVD9XCa2SaUujg==
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/KHqWL on line 9 4oPFBr/qCv1a1Jm6s37vQg==
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/KHqWL on line 9 PRPxQWADIWdKsOyxwWG90A==
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/KHqWL on line 9 fm5HAJbaOyD7UfIa5PchzQ==
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/KHqWL on line 9 nExvPTEB/rKRmnw3JmvGYA==
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/KHqWL 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/KHqWL on line 9 Hx97FVRIOrtBJZNCgHzNuA==
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/KHqWL on line 9 om7HSybUwPHNQIZWZgoVSw==
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/KHqWL on line 9 MuzwwyjXjIc+sF2mUtzkIA==
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/KHqWL on line 9 4BvLgTk7kuBPLrcI1Wg6tw==
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/KHqWL on line 9 Ph3eELmipZTCei/JpXmpkg==
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/KHqWL on line 9 Az+hHbrPoQBtdspP72RMIg==
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/KHqWL on line 9 yWh+imqs3tUYp9GRS3+lFA==
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/KHqWL on line 9 cC6l7lpOyvuFrnF1RW1ayQ==
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/KHqWL on line 9 vFwbMQ6543ckrEj5/KNtIw==
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/KHqWL on line 9 /p6ND+Ql9oO3RsPW/QB8+w==
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/KHqWL on line 9 yMNf4zWAacNG9suidUrEGQ==
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/KHqWL on line 9 +3e5NKyCKL3uASfVOmDVHg==
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/KHqWL on line 9 hll2We3P8U5JtnebxwHB2Q==
Output for 5.5.34
JcEsGDZEhEg0wnBwooXhxZWgQ3DwCOay4f2ErEIIQd4Zc7KttyWrH6HalZuO4zp3
Output for 5.5.33
MPG9b+Rt1BJeBjwObafLr7Vq0sdcobP3jP8XDQjbfdtCFLaPoWKHlexlDWSMPaI2
Output for 5.5.32
7ckWxaEC6QzcVRTfYkLXvsObwuMgDGimzAjBKziB/jgx7JC59q8ogvQZgNkh46u3
Output for 5.5.31
Z8tRki2ivvbox4GfoX4OU2IbOub2Kk4xKC7BuyUDfRVD2DAALdG1zxLVIWMq8FA8
Output for 5.5.30
r7QD49HA6w4EWLSwoobNdagJSZ2D492AxIFtPb0MOorisngmKG69YAm80LtubCTU
Output for 5.5.29
bzGz3Pw7aeU7u20J9l6C/dFYl6N6IbGHtA3OVIHNhM3Q4uftrwH/bN5A35WdHuP4
Output for 5.5.28
FdF+fDHEBBH2RYeVFaNpr26ywFCNhF8V2sWpUClS9Y3xTJt1YQhObXMKLHA23eqA
Output for 5.5.27
1j65gOn3uWIXbNJiNfT4QCyvoxcbKD1mC2UY/IaCv36r11bZlEgdBO5Hr5dGHdyU
Output for 5.5.26
4+iCovkXzmrqnHwUkkCecc1K5sTxTFTxBwHg7Y7DS92tjOH88bbJZaqDs8kNa0Bp
Output for 5.5.25
a9EJCjcem76+LJDhg0vwGhz/blyvlhnLLU0p5IS7whUWVksG+R+akJ31ElUpgCB8
Output for 5.5.24
t6d/zl89CqOcFb1LbQ07OAKhCzNTy3E2HXjJqB0IIPeYZIN9kvfAR1cNc9X7GNuv
Output for 5.4.45
XS70GNKC4qMjhOSdmtTWScVu3txz0pJ2BSi1tHZ4qbffLkgK9ffaXTQSxlyX7Kd5
Output for 5.4.44
DCJlipstflKfxDbxxtKfGhvZYByQ+5YYDHxkwwvhz4nUOCp4NtzhR/+xJ7DKch9n
Output for 5.4.43
wRrvt5IGurdleVYvcYKk900NZuo2/BtLQkArMUwA1xtL1O/uEt/F1lXTfxhWIsRV
Output for 5.4.42
fXzWxG7wngiu9s1DuqkKe6Ko2XYw0hPzRkeOPQF3maAFMpJbW4Xfm/tRYnCYdXdH
Output for 5.4.41
6t8f8htaKBeyYWZRaciYAIGdP5kEl6X1S4V+HhsbTiJh9QzbXkm6GcX1IsxATdJ5
Output for 5.4.40
Gakv3FOCNg3eUhb7oefnq5c8bScqLPBuYYZXwaWnw3GHjpCiguCxp1DTnT/du0xq
Output for 5.4.39
o77u4d5RHsE+QWPyQF97xtCBzudwsKtqkFov780R0+10Kv0FAQHOjclSAOFsWYD9
Output for 5.4.38
VTzL2vw3o5VXsrq8xIBEv7yj2Fu4b2c3zvI7sD8Piz2BbpYBATPbLGmWiSQg8xFA
Output for 5.4.37
/NCmQmRyI2nvBBIwsC3Et1QYZehCXcfAfHqsZHvg/MT1ISPjzWC7FN+OogqAvyrL
Output for 5.4.36
K6Hqps+c/liIqUaGJuG3ABhdvlJ6IzO5Rem0DtUzXQzF62O2AP3UmSJTWa8Su9Kz
Output for 5.4.35
7vB5sqM9yAIZGUteD658sLx/WbqT7NbLJXOhtWOkC70cJlxkTWmqjr63Q9+nQlXh
Output for 5.4.34
KX2uJ+5RGbbf20B3EKgYTv5zcm9uTvSHoNLTKDTSzJcChum+zN4zT9A3JclW5WCO
Output for 5.4.32
IR6mmoaQsnIeYDGZcgEG8mXj/CmKyYhrTZCyaRS0klJ4QdexPsdBp6UABLLLKiOv
Output for 5.4.31
caqadma/qPMZZY5OKhUGTiLIL8oof8SEV/UPXCsZtiuWEpYVjKLY7GKVqcK3lK1T
Output for 5.4.30
lbRyypSm7neUsnw101YOd+pPuDb+mWmBWXtOt6r/Bnp8GYQLMFLJOTGCJTlcL+hd
Output for 5.4.29
OGo5DHKdpVKQX/rgJmGwdvIqJg6s5Xm8PzEj9u5K8AcklDHEb/gDaMYmxBYIYKzZ
Output for 5.4.28
k9G2Qx9/pHVq/KaTvvV9nnclhteXNislEUacDEylCtOOeKobrrA8Fvb2Ax3LRN8r
Output for 5.4.27
FjgbsAOWk5SdFA3iEZkuaKQiRyqS5kYR6ObISXS6U3yhYETP4reriB1FY8ZwryCQ
Output for 5.4.26
hCpuMPVgsjbS8ycEEGp4mvW6mE+1YU7DDSfPkTx9yNy/arTjBwfxdT/ik/FORJwb
Output for 5.4.25
DJwPcWp/OSXmhrkdomgiVOa0CxEm48U0WH7ZG6OPujj/YlRJ36gYCRwxsrey0wZS
Output for 5.4.24
oTza6YYvhWS91e59PF7r4CH2VZQvp6aG5YmdBUrcStocvYPkMUQQqCjl8MFLQast
Output for 5.4.23
4+xYaODlFL4Uk8JWTfoQ6CkJkXD+pDVPQK7I7UBv0JvtZqU8Zv/xQJZ3t1UfDX8K
Output for 5.4.22
ETlcZ3eeElBIkxHSPZrTZFQYWWPcj9KoeRE25pbBj8NyDG6GsFybu6C5UKwGaBcP
Output for 5.4.21
LlqDj43O6HEVjBxmrvUklEUbiCsoTQP+gQohTFeg9bch8Ja8ka3RoP8LajTddOCf
Output for 5.4.20
exw4wf4bPlhdIbvnX0uDGWDUQ7R6y3pqJd/Evch7E2YgF4FD63U67YAr0+vlVRdH
Output for 5.4.19
wcDGhxZufnf1sUTfinEfkk3AQl6+dVWcB+y0JqyNamkeyIbv5BKnnCpP0rh/8dr4
Output for 5.4.18
+UNPGFCx+06ApGP+UjdMfr0uElTc8KkhZIx/aAqNl6EGtWLl/Lb/ZbRR2KiRpbLC
Output for 5.4.17
pgwqu672O/wNPwpGXUfagH05wykmdy+OHEL1NDoPnaYBUoc+22tDVetxvVtvPl9g
Output for 5.4.16
5jd6MSFpRESnY3AwLsB4oe92Yl0KY2O+7Um6ZtrOo9wmOz7ZC9om5AVQucrdxLgu
Output for 5.4.15
TawBYgczEZb7pbE2gQ2mGB7HLqyWgJzmq+PX0SPhv7+z3WRMCRQL4Hl9HE7ZiO+G
Output for 5.4.14
IJqUh2EI9Fv0Ss1Ihplcbx/O5UWNaaEdKvp2NkGHTHUuM2waeTwCn5ZL735ECK2h
Output for 5.4.13
dpn9myJsJ9LUjR4OPHfimgF9xfaueTivd/EetI6v3fDWy8h1D6DMGxOVtjcR1Dop
Output for 5.4.12
AAWFtxmADJIaNmZzuBzLaUPz0jOC1I4PB7vIeVswb7zDeZqDWqPE/mWE2+q4LRK3
Output for 5.4.11
HKNSebr+5MTt6sd7aOF/mQ++C+O7GIlAMxguJsGp9/HeKLokJ1dsDbjOX4u9HYgq
Output for 5.4.10
yHfWdzpxqUbefsDzoVRH95TcBlunGhnj+eG41sokPQHKQ+u6GjcEjBUntRqZ+fxa
Output for 5.4.9
LgL7cjWCrlY76pliAacn1upYgjcXOha9mXHHiSLlAESYM6GH86yLUFsVypIInUfP
Output for 5.4.8
6ahq3fmODPKtRp8W2hsAAlHZPbmgTAZkxuPGyyuZaTLkPwa77pMJqiKxv4brTYlA
Output for 5.4.7
ghXHhxYjyy6eNKxyatzDPMqGElBCM++711E4ESGgkLzSxsXwhU0ccYwpOqugETlg
Output for 5.4.6
3o5kFVygI79bZUhaakRi63RM+ne5MhPKyUsAtnT6lNTDUgwo7pfAUhBgvTiKrGNR
Output for 5.4.5
2WCByNyRu90Wavd+hjFQxqW4uiSVbSoNp1JSiAwIKbOSCmU9ENNDZ1dILWRqq6GQ
Output for 5.4.4
erxAOQjAJt5kd2Fp4MF4h0pHlw5eaaycKUAPyZPfbZLbYruuhWMUXZ+mAKIfs+E4
Output for 5.4.3
mSLapbliOn0cCguw8CX8HtDSCUksNKFS/rAqhXOZ7TRcKJbZq0hQahQMF8jdkN0r
Output for 5.4.2
iYDvFrvhB/5IH0dk/l80Ymk29txPCrMgtnutTggkf8FmOvEkeQENpWWWzATL2AtX
Output for 5.4.1
WyITN3ObZEbFsF6kW1wn0S+FlbiS22xYKBriIB8v9v4GTdaB9Fs0mq5aq9gO5WZn
Output for 5.4.0
N9mJQznEhEDVtU4+dYhuGPfOBGKQg0Oej6ZwVY1lpltb5RpZX2r1gYQICVddVtGI