fork(1) download
  1. <?php
  2. // Example Usage: echo xorencrypt('examplestring,'examplekey');
  3. function XOREncryption($InputString, $KeyPhrase){
  4. $KeyPhraseLength = strlen($KeyPhrase);
  5. for ($i = 0; $i < strlen($InputString); $i++){
  6. $rPos = $i % $KeyPhraseLength;
  7. $r = ord($InputString[$i]) ^ ord($KeyPhrase[$rPos]);
  8. $InputString[$i] = chr($r);
  9. }
  10. return $InputString;
  11. }
  12. function xorencrypt($InputString, $KeyPhrase){
  13. $InputString = XOREncryption($InputString, $KeyPhrase);
  14. $InputString = base64_encode($InputString);
  15. return $InputString;
  16. }
  17. function xordecrypt($InputString, $KeyPhrase){
  18. $InputString = base64_decode($InputString);
  19. $InputString = XOREncryption($InputString, $KeyPhrase);
  20. return $InputString;
  21. }
  22. ?>
Success #stdin #stdout 0.02s 13112KB
stdin
Standard input is empty
stdout
Standard output is empty