Mmm, so I said best obfuscation huh. I wonder how well this is going to go.
And the winner is
gluser3f
Congratulations
I haven't pasted the code here, because there is simply way too much trickery
involved (excessively long lines, 8-bit characters) which would be pretty
meaningless if posted on the board. So they're all in the ZIP file
for handy reference.
And now, the entries themselves.
Entry from breezer
Some problems getting the code to compile (non-standard header stdafx.h)
and the pow() function was ambiguous.
On the 11th day, some text is missing (like the 7th day)
Nine drummers drumming
Eight maids milkingg
Six geese laying
Five gold rings
And the order of 'gifts' is incorrect compared to the reference URL.
Apart from that, it seems pretty obvious that the whole of the text is
encoded in the binary string, where each set of 8 '1' and '0' characters
is the binary representation of an ASCII character.
Score 3/10
Entry from CornedBee
Though having got past that, it did produce the required results.Code:Compiled with warnings Entry from $ g++ -trigraphs CornedBee CornedBee_xmassong.cpp:35:39: warning: pasting "<" and "iter" does not give a valid preprocessing token CornedBee_xmassong.cpp:35:39: warning: pasting "ator" and ">" does not give a valid preprocessing token CornedBee_xmassong.cpp:37:39: warning: pasting "<" and "str" does not give a valid preprocessing token CornedBee_xmassong.cpp:37:39: warning: pasting "ing" and ">" does not give a valid preprocessing token CornedBee_xmassong.cpp:44:39: warning: pasting "<" and "iost" does not give a valid preprocessing token CornedBee_xmassong.cpp:44:39: warning: pasting "ream" and ">" does not give a valid preprocessing token CornedBee_xmassong.cpp:47:39: warning: pasting "<" and "algor" does not give a valid preprocessing token CornedBee_xmassong.cpp:47:39: warning: pasting "ithm" and ">" does not give a valid preprocessing token CornedBee_xmassong.cpp:49:39: warning: pasting "<" and "funct" does not give a valid preprocessing token CornedBee_xmassong.cpp:49:39: warning: pasting "ional" and ">" does not give a valid preprocessing token
The presence of a few recognisable strings suggests ways of determining how it works.
The initial song appears to make no sense - what is "Four Hydralisks" doing in there,
but the appearance of a function called transform() strongly suggests that another
of the arrays is merely a substition of some sort to recover the original words.
Score 5/10
Entry from dbgtgoten
Won't compile.
The first problem being that comments are replaced with a single space character,
but things like
#/*I*/i/*N*/nclude <std/*I*/io.h>
require them to be deleted.
The s[257] array contains many characters which are non-ASCII. I think it is
implementation specific what would happen to these characters.
Fixes to make it compile using gcc
1. remove all the comments
2. remove the entirely redundant fout, which just opens and closes a file
It's also deprecated C++ as well.
It almost produces the correct result
On the wlvh day of Christmas my true love sent to me
Twelve drummers drummingL
Eleven pipers pipingL
There seems to be a lot of trailing 'L' characters, and the names of days (eg wlvh)
are all strangely mangled.
My initial guess is that its just working on some kind of alphabetic substitution.
Score 2/10
Entry from gluser3f
Top stuff!
Compiles OK, produces the required output and I haven't got a clue
as to how it works yet, except that it includes copies of itself
several times over.
There is no visible text of any of the words of the song.
Score 9/10
Entry from Magos
Mmm, some trickery with using the filename...
Magos_ChristmasSong.cpp:47:12: ChristmasDays.cpp: No such file or directory
Having overcome that little hurdle, there was one small fault in the output
See gluser3f's entry on how to include yourself properly.
and two turtle doves,
The 'and' should be at the end of the line
It shouldn't be too difficult to work out what is going on here.
A significant proportion of the output text is in the clear.
Score 5/10
Entry from major
Compiles and runs OK, but only mildly obfuscated (just folds everything onto a few
long lines). All the words are easily seen with a bit of reformatting the code.
Score 3/10
Entry from Sangdrax
Compiles and runs OK, but only mildly obfuscated. The whole song is in clear
text.
I'm not that good with C++ templates, but it seems to me that the two templates
handle a recursive case and a base case.
Score 3/10
Entry from Thantos
Compiles and runs OK, but only mildly obfuscated.
The tables are basically a shifted alphabet. The out() function pretty much
gives the game away.
Score 4/10