Advertisement
aantamimmaarif

Encryption & Decryption

Oct 28th, 2018
777
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.91 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4.     <title>Encryption &amp; Decryption</title>
  5. </head>
  6. <body>
  7. <form action="" method="POST">
  8.  <textarea name="input" cols="30" rows="8"></textarea>
  9.  <br>
  10.  <input type="submit" name="submit" value="Encrypt!" />
  11. </form>
  12.  
  13. <?php
  14. if(isset($_POST['submit'])) {
  15.     $input = $_POST['input'];
  16.  
  17.     $key = array(
  18.      'a' => '?',
  19.      'i' => '$',
  20.      'u' => '^',
  21.      'e' => '#',
  22.      'o' => '+',
  23.      ' ' => 'zZ',
  24.      'A' => '!',
  25.      'I' => '%',
  26.      'U' => '_',
  27.      'E' => '=',
  28.      'O' => '*'
  29.     );
  30.     $key2 = array(
  31.      '?' => 'a',
  32.      '$' => 'i',
  33.      '^' => 'u',
  34.      '#' => 'e',
  35.      '+' => 'o',
  36.      'zZ' => ' ',
  37.      '!' => 'A',
  38.      '%' => 'I',
  39.      '_' => 'U',
  40.      '=' => 'E',
  41.      '*' => 'O'
  42.     );
  43.     $enkripsi = str_replace(array_keys($key), $key, $input);
  44.     $dekripsi = str_replace(array_keys($key2), $key2, $enkripsi);
  45.  
  46.     echo 'Encryption : '.$enkripsi;
  47.     echo '<br>';
  48.     echo 'Decryption : '.$dekripsi;
  49.     }
  50. ?>
  51. </body>
  52. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement