Skip to content

Instantly share code, notes, and snippets.

@vhqtvn vhqtvn/TMCTF2015-crypto500.php Secret
Created Sep 28, 2015

Embed
What would you like to do?
<?php
$cs=str_split("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ");
foreach ($cs as $i) {
test($i);
foreach ($cs as $j) {
test($i.$j);
foreach ($cs as $k) {
test($i.$j.$k);
}
}
}
$sol=[];
foreach (array_merge($cs,["+","/"]) as $i) {
if(!isset($a[$i])) $sol[]=$i;
}
usort($sol, function($a,$b){return ord($a)-ord($b);});
echo implode("",$sol)."\n";
echo 'TMCTF{'.sha1(implode("",$sol)).'}';
function test($s){
global $a;
foreach(str_split(base64_encode($s)) as $c) $a[$c]=1;
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.