Skip to content

Instantly share code, notes, and snippets.

@John2496
Created September 27, 2011 20:25
Show Gist options
  • Save John2496/1246131 to your computer and use it in GitHub Desktop.
Save John2496/1246131 to your computer and use it in GitHub Desktop.
<?php
function encode($key = 'testkey', $data = 'method=Achievements.leaderboard')
{
$result = '';
for($i = 0; $i < strlen($data); $i++)
{
$char = substr($data, $i, 1);
$char ^= substr($key, ($i % strlen($key)), 1);
$result .= $char;
}
return $result;
}
echo encode('our_secret_key', 'method=blah&some_var=cheese');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment