Skip to content

Instantly share code, notes, and snippets.

@duongkai
Created October 3, 2015 00:17
Show Gist options
  • Select an option

  • Save duongkai/d2a6a3c52c39e2a0ad5b to your computer and use it in GitHub Desktop.

Select an option

Save duongkai/d2a6a3c52c39e2a0ad5b to your computer and use it in GitHub Desktop.
practice 5
<title>CrypotCrypotCrypot</title>
<pre><h3>
<?php
$FLAG = 'XXXXXXXXXXXXXXX_censored_XXXXXXXXXXXXX';
$LENGTH_FLAG = strlen($FLAG);
$KEY = empty($_GET['key']) ? "TEST" : $_GET['key'];
$sha1_all = hash("sha512","\x00",true); //init
echo "Your KEY : <font color=Green>$KEY</font>\n";
for($i=0; $i < $LENGTH_FLAG; $i++){
$KEY[$i] = empty($KEY[$i]) ? "\xff" : $KEY[$i];
$c = $KEY[$i].str_repeat($FLAG[$i],$LENGTH_FLAG - strlen($KEY[$i]));
$sha1_all ^= hash("sha512",$c,true);
}
echo "Your FLAG: <font color=Red>".bin2hex($sha1_all ^ $FLAG)."</font>\n\n";
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment