Created
October 3, 2015 00:17
-
-
Save duongkai/d2a6a3c52c39e2a0ad5b to your computer and use it in GitHub Desktop.
practice 5
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <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