UK GCHQ Challenge – Just got to part 3
s3-eu-west-1.amazonaws.com
s3-eu-west-1.amazonaws.com
Let's go for B, and have some fun! Have a look at the source code.
The answer validator works in this way.
1) convert the 4 answer to lowercase (thank you, the space is reduced to 26 character, not bad).
2) call val() and concatenate, now we have something like a\0b\0c\0d
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.
resultA += dat.toLowerCase().charCodeAt(j);
and resultB is for each step resultA * 31 XOR with the previous version of resultB.
resultB = (resultA * 31) ^ resultB;
fancy. Couple of other And. tmp = resultA & resultA; resultA = resultB & resultB; resultB = tmp;
and finally a XOR.
resultA = resultA ^ initA;
resultB = resultB ^ initB;
Now, luckily enough, this transformation are reversible. It does remind me and encoding system. A variation of a famose one.So, anyone up for a challenge ?