Advertisement
Guest User

Untitled

a guest
Jun 22nd, 2017
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. <?php
  2.  
  3. #######################################
  4. # notepads uber 1337 encryption codez #
  5. #######################################
  6.  
  7. $text = 'A secret.';
  8.  
  9. if(!isset($chars))
  10. {
  11. // 3 different symbols (or combinations) for obfuscation
  12. // these should not appear within the original text
  13. $sym = array('¶', '¥xQ', '|');
  14.  
  15. foreach(range('a','z') as $key=>$val)
  16. $chars[$val] = str_repeat($sym[0],($key + 1)).$sym[1];
  17. $chars[' '] = $sym[2];
  18.  
  19. unset($sym);
  20. }
  21.  
  22. // encrypt
  23. function encrypt($data)
  24. {
  25. $data = strtr(strtolower($data), $GLOBALS['chars']);
  26. return $data;
  27. }
  28.  
  29. // decrypt
  30. function decrypt($data)
  31. {
  32. $charset = array_flip($GLOBALS['chars']);
  33. $charset = array_reverse($charset, true);
  34.  
  35. $data = strtr($data, $charset);
  36. unset($charset);
  37. return $data;
  38. }
  39.  
  40. $text = encrypt($text);
  41. echo 'encrypted: '.$text.'<br />';
  42. // echo 'decrypted: '.decrypt($text);
  43.  
  44. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement