for ani - 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.

Your result can be seen below.

Result of php executing

Full code of for ani.php

  1. <?php
  2. //$key should have been previously generated in a cryptographically safe way, like openssl_random_pseudo_bytes
  3. $plaintext = "message to be encrypted message to be encrypted message to be encrypted message to be encrypted message to be encrypted message to be encrypted";
  4. $cipher = "aes-128-gcm";
  5. if (in_array($cipher, openssl_get_cipher_methods()))
  6. {
  7.     $ivlen = openssl_cipher_iv_length($cipher);
  8.     $iv = openssl_random_pseudo_bytes($ivlen);
  9.     $ciphertext = openssl_encrypt($plaintext, $cipher, 'abcdefg', $options=0, $iv, $tag);
  10.     //store $cipher, $iv, and $tag for decryption later
  11.     $original_plaintext = openssl_decrypt($ciphertext, $cipher, 'abcdefg', $options=0, $iv, $tag);
  12.     echo $original_plaintext."\n";
  13.         echo $ciphertext."\n";
  14. }
File Description
  • for ani
  • PHP Code
  • 16 Jul-2021
  • 757 Bytes
You can Share it: