6d84ff02bf41de6e38c531f19567772be66c2f777ee02deef3ff0689873b
<?php
$flag = file_get_contents(".flag");
$key = hex2bin(trim(file_get_contents(".key")));
function xor_string($string, $key) {
for($i = 0; $i < strlen($string); $i++)
$string[$i] = ($string[$i] ^ $key[$i % strlen($key)]);
return $string;
}
$ciphertext = xor_string($flag, $key);
if (isset($_GET["encrypthex"])){
if (ctype_xdigit($_GET["encrypthex"])){
$ciphertext = xor_string(hex2bin($_GET["encrypthex"]), $key);
} else {
$ciphertext = "Please Feed Me HEX";
}
}
echo "<h6>".bin2hex($ciphertext)."</h6>";
echo highlight_file(__FILE__, true);
?>