Skip to content

Instantly share code, notes, and snippets.

@Antosser
Created August 12, 2023 11:04
Show Gist options
  • Save Antosser/55a934564c2455ba70ad40f201953571 to your computer and use it in GitHub Desktop.
Save Antosser/55a934564c2455ba70ad40f201953571 to your computer and use it in GitHub Desktop.
GJP decryption
<?php
$gjp = "your_encoded_gjp_here";
$gjpdecode = str_replace("_", "/", $gjp);
$gjpdecode = str_replace("-", "+", $gjpdecode);
$gjpdecode = base64_decode($gjpdecode);
class XORCipher {
public static function cipher($plaintext, $key) {
$key = self::text2ascii($key);
$plaintext = self::text2ascii($plaintext);
$keysize = count($key);
$input_size = count($plaintext);
$cipher = "";
for ($i = 0; $i < $input_size; $i++)
$cipher .= chr($plaintext[$i] ^ $key[$i % $keysize]);
return $cipher;
}
private static function text2ascii($text) {
return array_map('ord', str_split($text));
}
}
$decrypted_text = XORCipher::cipher($gjpdecode, 37526);
echo "Decrypted Text: " . $decrypted_text . "\n";
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment