Advertisement
coderail

RXOR - PHP

Sep 2nd, 2012
898
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. //------------------
  2. //Creator: aeonhack
  3. //Site: elitevs.net
  4. //Created: 9/20/2012
  5. //Changed: 9/20/2012
  6. //Version: 1.0.0
  7. //------------------
  8. function rxor($data, $key) {
  9. $rawKey = array_merge(unpack('C*', $key));
  10. $rawData = array_merge(unpack('C*', $data));
  11.  
  12. $n1 = 11;
  13. $n2 = 13;
  14. $ns = 257;
  15.  
  16. $out = '';
  17. $keyLen = count($rawKey);
  18.  
  19. for ($i = 0; $i < $keyLen; $i++) {
  20. $ns += $ns % ($rawKey[$i] + 1);
  21. }
  22.  
  23. for ($i = 0; $i < count($rawData); $i++) {
  24. $ns = $rawKey[$i % $keyLen] + $ns;
  25. $n1 = ($ns + 5) * ($n1 & 255) + ($n1 >> 8);
  26. $n2 = ($ns + 7) * ($n2 & 255) + ($n2 >> 8);
  27. $ns = (($n1 << 8) + $n2) & 255;
  28.  
  29. $out .= chr($rawData[$i] ^ $ns);
  30. }
  31.  
  32. return $out;
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement