@ 2017-07-05T14:26:40Z <?php
function pkcs7_pad($str)
{
$len = mb_strlen($str, '8bit');
$c = 16 - ($len % 16);
$str .= str_repeat(chr($c), $c);
return $str;
}
$message = 'test';
$key = openssl_random_pseudo_bytes(16);
$iv = openssl_random_pseudo_bytes(16);
$cipher = mcrypt_encrypt(
MCRYPT_RIJNDAEL_128,
$key,
$message,
'ctr',
$iv
);
$plain = openssl_decrypt(
$cipher,
'aes-128-ctr',
$key,
OPENSSL_RAW_DATA,
$iv
);
var_dump(
$message,
bin2hex($cipher),
$plain,
mb_strlen($message, '8bit'),
mb_strlen($plain, '8bit'),
$message === $plain
);
Enable javascript to submit You have javascript disabled. You will not be able to edit any code.
Output for 7.1.26 - 7.1.33 , 7.2.17 - 7.2.33 , 7.3.0 - 7.3.33 , 7.4.0 - 7.4.33 , 8.0.0 - 8.0.30 , 8.1.0 - 8.1.28 , 8.2.0 - 8.2.18 , 8.3.0 - 8.3.4 , 8.3.6 Fatal error: Uncaught Error: Call to undefined function openssl_random_pseudo_bytes() in /in/oBPR0:11
Stack trace:
#0 {main}
thrown in /in/oBPR0 on line 11
Process exited with code 255 . Output for 8.3.5 Warning: PHP Startup: Unable to load dynamic library 'sodium.so' (tried: /usr/lib/php/8.3.5/modules/sodium.so (libsodium.so.23: cannot open shared object file: No such file or directory), /usr/lib/php/8.3.5/modules/sodium.so.so (/usr/lib/php/8.3.5/modules/sodium.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
Fatal error: Uncaught Error: Call to undefined function openssl_random_pseudo_bytes() in /in/oBPR0:11
Stack trace:
#0 {main}
thrown in /in/oBPR0 on line 11
Process exited with code 255 . Output for 7.0.0 - 7.0.20 , 7.1.0 - 7.1.7 Fatal error: Uncaught Error: Call to undefined function mcrypt_encrypt() in /in/oBPR0:14
Stack trace:
#0 {main}
thrown in /in/oBPR0 on line 14
Process exited with code 255 . Output for 5.5.35 - 5.5.38 , 5.6.0 - 5.6.30 Fatal error: Call to undefined function mcrypt_encrypt() in /in/oBPR0 on line 14
Process exited with code 255 . Output for 5.5.34 string(4) "test"
string(8) "176f7647"
string(4) "test"
int(4)
int(4)
bool(true)
Output for 5.5.33 string(4) "test"
string(8) "ed8c40a0"
string(4) "test"
int(4)
int(4)
bool(true)
Output for 5.5.32 string(4) "test"
string(8) "536c999f"
string(4) "test"
int(4)
int(4)
bool(true)
Output for 5.5.31 string(4) "test"
string(8) "c29435e8"
string(4) "test"
int(4)
int(4)
bool(true)
Output for 5.5.30 string(4) "test"
string(8) "2ef3cc35"
string(4) "test"
int(4)
int(4)
bool(true)
Output for 5.5.29 string(4) "test"
string(8) "b371c9dc"
string(4) "test"
int(4)
int(4)
bool(true)
Output for 5.5.28 string(4) "test"
string(8) "4aaf39d9"
string(4) "test"
int(4)
int(4)
bool(true)
Output for 5.5.27 string(4) "test"
string(8) "da2472a4"
string(4) "test"
int(4)
int(4)
bool(true)
Output for 5.5.26 string(4) "test"
string(8) "60122f64"
string(4) "test"
int(4)
int(4)
bool(true)
Output for 5.5.25 string(4) "test"
string(8) "626b15ac"
string(4) "test"
int(4)
int(4)
bool(true)
Output for 5.5.24 string(4) "test"
string(8) "f2274cef"
string(4) "test"
int(4)
int(4)
bool(true)
Output for 5.5.23 string(4) "test"
string(8) "249ccd2f"
string(4) "test"
int(4)
int(4)
bool(true)
Output for 5.5.22 string(4) "test"
string(8) "3a391d5e"
string(4) "test"
int(4)
int(4)
bool(true)
Output for 5.5.21 string(4) "test"
string(8) "969b6cc1"
string(4) "test"
int(4)
int(4)
bool(true)
Output for 5.5.20 string(4) "test"
string(8) "09d5f59e"
string(4) "test"
int(4)
int(4)
bool(true)
Output for 5.5.19 string(4) "test"
string(8) "c2f1700b"
string(4) "test"
int(4)
int(4)
bool(true)
Output for 5.5.18 string(4) "test"
string(8) "f126a3f6"
string(4) "test"
int(4)
int(4)
bool(true)
Output for 5.5.16 string(4) "test"
string(8) "31952313"
string(4) "test"
int(4)
int(4)
bool(true)
Output for 5.5.15 string(4) "test"
string(8) "ca8eae1b"
string(4) "test"
int(4)
int(4)
bool(true)
Output for 5.5.14 string(4) "test"
string(8) "68da8823"
string(4) "test"
int(4)
int(4)
bool(true)
Output for 5.5.13 string(4) "test"
string(8) "4d9e56ba"
string(4) "test"
int(4)
int(4)
bool(true)
Output for 5.5.12 string(4) "test"
string(8) "ca30d100"
string(4) "test"
int(4)
int(4)
bool(true)
Output for 5.5.11 string(4) "test"
string(8) "7bdd6c1b"
string(4) "test"
int(4)
int(4)
bool(true)
Output for 5.5.10 string(4) "test"
string(8) "b1ec778f"
string(4) "test"
int(4)
int(4)
bool(true)
Output for 5.5.9 string(4) "test"
string(8) "35859a11"
string(4) "test"
int(4)
int(4)
bool(true)
Output for 5.5.8 string(4) "test"
string(8) "3b47b785"
string(4) "test"
int(4)
int(4)
bool(true)
Output for 5.5.7 string(4) "test"
string(8) "697b76d8"
string(4) "test"
int(4)
int(4)
bool(true)
Output for 5.5.6 string(4) "test"
string(8) "405f5ab6"
string(4) "test"
int(4)
int(4)
bool(true)
Output for 5.5.5 string(4) "test"
string(8) "4cad532a"
string(4) "test"
int(4)
int(4)
bool(true)
Output for 5.5.4 string(4) "test"
string(8) "c3969487"
string(4) "test"
int(4)
int(4)
bool(true)
Output for 5.5.3 string(4) "test"
string(8) "419ca124"
string(4) "test"
int(4)
int(4)
bool(true)
Output for 5.5.2 string(4) "test"
string(8) "db6d1c67"
string(4) "test"
int(4)
int(4)
bool(true)
Output for 5.5.1 string(4) "test"
string(8) "1770dc6e"
string(4) "test"
int(4)
int(4)
bool(true)
Output for 5.5.0 string(4) "test"
string(8) "30e1ac8a"
string(4) "test"
int(4)
int(4)
bool(true)
Output for 5.4.45 string(4) "test"
string(8) "65f6fd39"
string(4) "test"
int(4)
int(4)
bool(true)
Output for 5.4.44 string(4) "test"
string(8) "4b81f863"
string(4) "test"
int(4)
int(4)
bool(true)
Output for 5.4.43 string(4) "test"
string(8) "1d34e690"
string(4) "test"
int(4)
int(4)
bool(true)
Output for 5.4.42 string(4) "test"
string(8) "fc79ca73"
string(4) "test"
int(4)
int(4)
bool(true)
Output for 5.4.41 string(4) "test"
string(8) "70fe91e8"
string(4) "test"
int(4)
int(4)
bool(true)
Output for 5.4.40 string(4) "test"
string(8) "ca329558"
string(4) "test"
int(4)
int(4)
bool(true)
Output for 5.4.39 string(4) "test"
string(8) "b039ea55"
string(4) "test"
int(4)
int(4)
bool(true)
Output for 5.4.38 string(4) "test"
string(8) "54e8dfdd"
string(4) "test"
int(4)
int(4)
bool(true)
Output for 5.4.37 string(4) "test"
string(8) "ef4a8a1d"
string(4) "test"
int(4)
int(4)
bool(true)
Output for 5.4.36 string(4) "test"
string(8) "00d52175"
string(4) "test"
int(4)
int(4)
bool(true)
Output for 5.4.35 string(4) "test"
string(8) "7c1cc1f6"
string(4) "test"
int(4)
int(4)
bool(true)
Output for 5.4.34 string(4) "test"
string(8) "e0215b52"
string(4) "test"
int(4)
int(4)
bool(true)
Output for 5.4.32 string(4) "test"
string(8) "2537f35b"
string(4) "test"
int(4)
int(4)
bool(true)
Output for 5.4.31 string(4) "test"
string(8) "61ddd460"
string(4) "test"
int(4)
int(4)
bool(true)
Output for 5.4.30 string(4) "test"
string(8) "c4724380"
string(4) "test"
int(4)
int(4)
bool(true)
Output for 5.4.29 string(4) "test"
string(8) "2eb3de06"
string(4) "test"
int(4)
int(4)
bool(true)
Output for 5.4.28 string(4) "test"
string(8) "ebe194df"
string(4) "test"
int(4)
int(4)
bool(true)
Output for 5.4.27 string(4) "test"
string(8) "6a5e272f"
string(4) "test"
int(4)
int(4)
bool(true)
Output for 5.4.26 string(4) "test"
string(8) "514d0ee2"
string(4) "test"
int(4)
int(4)
bool(true)
Output for 5.4.25 string(4) "test"
string(8) "fbc0036a"
string(4) "test"
int(4)
int(4)
bool(true)
Output for 5.4.24 string(4) "test"
string(8) "a05f5620"
string(4) "test"
int(4)
int(4)
bool(true)
Output for 5.4.23 string(4) "test"
string(8) "cd066e5a"
string(4) "test"
int(4)
int(4)
bool(true)
Output for 5.4.22 string(4) "test"
string(8) "890586cf"
string(4) "test"
int(4)
int(4)
bool(true)
Output for 5.4.21 string(4) "test"
string(8) "9bb36dae"
string(4) "test"
int(4)
int(4)
bool(true)
Output for 5.4.20 string(4) "test"
string(8) "d3dbc296"
string(4) "test"
int(4)
int(4)
bool(true)
Output for 5.4.19 string(4) "test"
string(8) "60e66ad6"
string(4) "test"
int(4)
int(4)
bool(true)
Output for 5.4.18 string(4) "test"
string(8) "935a6d8c"
string(4) "test"
int(4)
int(4)
bool(true)
Output for 5.4.17 string(4) "test"
string(8) "dd66e42d"
string(4) "test"
int(4)
int(4)
bool(true)
Output for 5.4.16 string(4) "test"
string(8) "31c9a4b2"
string(4) "test"
int(4)
int(4)
bool(true)
Output for 5.4.15 string(4) "test"
string(8) "46508456"
string(4) "test"
int(4)
int(4)
bool(true)
Output for 5.0.0 - 5.0.5 , 5.1.0 - 5.1.6 , 5.2.0 - 5.2.17 , 5.3.0 - 5.3.29 , 5.4.0 - 5.4.14 Fatal error: Call to undefined function openssl_random_pseudo_bytes() in /in/oBPR0 on line 11
Process exited with code 255 . Output for 4.4.5 - 4.4.9 Fatal error: Call to undefined function: openssl_random_pseudo_bytes() in /in/oBPR0 on line 11
Process exited with code 255 . Output for 4.3.2 - 4.3.11 , 4.4.0 - 4.4.4 Fatal error: Call to undefined function: openssl_random_pseudo_bytes() in /in/oBPR0 on line 11
Process exited with code 255 . Output for 4.3.0 - 4.3.1 Fatal error: Call to undefined function: openssl_random_pseudo_bytes() in /in/oBPR0 on line 11
preferences:dark mode live preview
255.67 ms | 401 KiB | 396 Q