ttt - PHP Online
Form of PHP Sandbox
Enter Your PHP code here for testing/debugging in the Online PHP Sandbox. As in the usual PHP files, you can also add HTML, but do not forget to add the tag <?php
in the places where the PHP script should be executed.
Result of php executing
Full code of ttt.php
- <?php
- $api_secret = '$2y$10$7r/5ypnAo/yl2tdzciapbuuEJYxi3HawvUirItSsnrWseP0VcvWQK';
- $data = '359883430246';
- $strong = true;
- $options = 0;
- $iv = openssl_random_pseudo_bytes(openssl_cipher_iv_length('aes-256-cbc'), $strong);
- $encrypted = openssl_encrypt($data, 'aes-256-cbc', $api_secret, $options, $iv);
- $encryptedWithsalt = $iv.$encrypted;
- $encrypted_data = base64_encode($encryptedWithsalt);
- echo 'iv(base 64): '.base64_encode($iv)."\n";
- echo 'encrypted(base 64): '.$encrypted."\n";
- echo 'encrypted with salt: '.$encryptedWithsalt."\n";
- echo 'encrypted with salt(base 64 ): '.$encrypted_data."\n";
- $data = base64_decode($encrypted_data);
- $iv_length = openssl_cipher_iv_length('aes-256-cbc');
- $iv = substr($data, 0, $iv_length);
- $data = substr($data, $iv_length);
- $data = openssl_decrypt($data, 'aes-256-cbc', $api_secret, $options, $iv);
- echo 'decrypted: '.$data."\n";
File Description
- ttt
- PHP Code
- 12 Apr-2022
- 1.03 Kb
You can Share it:
Latest PHP Pastes