Thread: The xmas Song competition results

  1. #1
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659

    The xmas Song competition results

    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
    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
    Though having got past that, it did produce the required results.
    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
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  2. #2
    mov.w #$1337,D0 Jeremy G's Avatar
    Join Date
    Nov 2001
    Posts
    704
    I did ask for you to tell me if it didnt compile with what ever you compiled so I could send you a non commented version.

    Seems a reasonable request when dealing with cross compiling compatability.
    c++->visualc++->directx->opengl->c++;
    (it should be realized my posts are all in a light hearted manner. And should not be taken offense to.)

  3. #3
    & the hat of GPL slaying Thantos's Avatar
    Join Date
    Sep 2001
    Posts
    5,681
    Of course its not like he didn't say on what platform and compiler he would be using.

    Should have spent more time on mine

  4. #4
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,895
    Actually mine combines two arrays to form the final output.

    If my laptop wasn't in repair, I could have tested (and got rid of the warnings) myself.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Nested for loop...search & display a list within a list
    By chadsxe in forum C++ Programming
    Replies: 13
    Last Post: 07-20-2005, 01:34 PM
  2. Xmas competitions
    By Salem in forum Contests Board
    Replies: 88
    Last Post: 01-03-2004, 02:08 PM
  3. The Xmas Tree competition results
    By Salem in forum Contests Board
    Replies: 10
    Last Post: 12-30-2003, 05:26 AM
  4. Same seed for srand yields different results
    By codegirl in forum C++ Programming
    Replies: 3
    Last Post: 06-23-2003, 02:39 PM
  5. all you smart people > help finding a song.
    By ... in forum A Brief History of Cprogramming.com
    Replies: 5
    Last Post: 03-07-2003, 02:39 AM