TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

UK GCHQ Challenge – Just got to part 3

1 pointsby snickmyover 9 years ago

1 comment

snickmyover 9 years ago
Now, there are two approaches: A) I&#x27;ll try to answer the question or B) I&#x27;ll try to crack the link to the next step.<p>Let&#x27;s go for B, and have some fun! Have a look at the source code.<p>The answer validator works in this way.<p>1) convert the 4 answer to lowercase (thank you, the space is reduced to 26 character, not bad).<p>2) call val() and concatenate, now we have something like a\0b\0c\0d<p>3) the validation function. in that function there are 2 things happening. resultA is summed with the ASHII code of each character concatenated in the string.<p>resultA += dat.toLowerCase().charCodeAt(j);<p>and resultB is for each step resultA * 31 XOR with the previous version of resultB.<p>resultB = (resultA * 31) ^ resultB;<p>fancy. Couple of other And. tmp = resultA &amp; resultA; resultA = resultB &amp; resultB; resultB = tmp;<p>and finally a XOR.<p><pre><code> resultA = resultA ^ initA; resultB = resultB ^ initB; </code></pre> Now, luckily enough, this transformation are reversible. It does remind me and encoding system. A variation of a famose one.<p>So, anyone up for a challenge ?