Skip to content

Instantly share code, notes, and snippets.

@vhqtvn
Created September 28, 2015 15:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vhqtvn/c6922f2b6955714488bf to your computer and use it in GitHub Desktop.
Save vhqtvn/c6922f2b6955714488bf to your computer and use it in GitHub Desktop.
<?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