Advertisement
sunraycafe

Obfuscated Code - Twelve Days

Jul 25th, 2017
725
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 5.35 KB | None | 0 0
  1. /* See information about code further down */
  2.  
  3. #include <stdio.h>
  4. main(t,_,a)
  5. char *a;
  6. {
  7. return!0<t?t<3?main(-79,-13,a+main(-87,1-_,main(-86,0,a+1)+a)):
  8. 1,t<_?main(t+1,_,a):3,main(-94,-27+t,a)&&t==2?_<13?
  9. main(2,_+1,"%s %d %d\n"):9:16:t<0?t<-72?main(_,t,
  10. "@n'+,#'/*{}w+/w#cdnr/+,{}r/*de}+,/*{*+,/w{%+,/w#q#n+,/#{l+,/n{n+,/+#n+,/#\
  11. ;#q#n+,/+k#;*+,/'r :'d*'3,}{w+K w'K:'+}e#';dq#'l \
  12. q#'+d'K#!/+k#;q#'r}eKK#}w'r}eKK{nl]'/#;#q#n'){)#}w'){){nl]'/+#n';d}rw' i;# \
  13. ){nl]!/n{n#'; r{#w'r nc{nl]'/#{l,+'K {rw' iK{;[{nl]'/w#q#n'wk nw' \
  14. iwk{KK{nl]!/w{%'l##w#' i; :{nl]'/*{q#'ld;r'}{nlwb!/*de}'c \
  15. ;;{nl'-{}rw]'/+,}##'*}#nc,',#nw]'/+kd'+e}+;#'rdq#w! nr'/ ') }+}{rl#'{n' ')#\
  16. }'+}##(!!/")
  17.   :t<-50?_==*a?putchar(31[a]):main(-65,_,a+1):main((*a=='/')+t,_,a+1)
  18.     :0<t?main(2,2,"%s"):*a=='/'||main(0,main(-61,*a,
  19. "!ek;dc i@bK'(q)-[w]*%n+r3#l,{}:\nuwloca-O;m .vpbks,fxntdCeghiry"),a+1);
  20. }
  21.  
  22.  
  23.  
  24. /* PERSONAL DISCLAIMER */
  25. /* I did not write this. I found this code online in the late 90s sometime.        */
  26. /* I do remember that it was posted as winning an obfuscation contest somewhere.   */
  27. /* In order to give some sort of attribution, I dug around online, and found       */
  28. /* what you see below. I cannot verify its accuracy, but it's something at least.  */
  29. /* The code on the page where I found this (http://udel.edu/~mm/xmas/) differs     */
  30. /* only in formatting, as near as I can tell (spot checked, not fully read).       */
  31.  
  32. /* WHAT DOES IT DO?? */
  33. /* So, to see what the code does, you can compile and execute it, as is. If you    */
  34. /* don't have a C compiler laying around (or you don't trust random online code),  */
  35. /* you can use the online compiler at:                                             */
  36. /*      https://www.tutorialspoint.com/compile_c_online.php                        */
  37. /*                                                                                 */
  38. /* Or, if you'd rather just know, I'll tell you below the attribution information. */
  39.  
  40. /*
  41. Least likely to compile successfully: <ian@unipalm.co.uk> Ian Phillipps
  42.  
  43.     Ian Phillipps
  44.     Cambridge Consultants Ltd
  45.     Science Park
  46.     Milton Road
  47.     Cambridge CB4 4DW
  48.     England
  49.  
  50. Compile and run without parameters.
  51.  
  52. The program is smaller than even the 'compressed' form of its output,
  53. and thus represents a new departure in text compression standards.
  54.  
  55. The judges thought that this program looked like what you would get
  56. by pounding on the keys of an old typewriter at random.
  57.  
  58. Copyright (c) 1988, Landon Curt Noll & Larry Bassel.
  59. All Rights Reserved.  Permission for personal, educational or non-profit use
  60. is granted provided this this copyright and notice are included in its entirety
  61. and remains unaltered.  All other uses must receive prior permission in
  62. writing from both Landon Curt Noll and Larry Bassel.
  63. */
  64.  
  65.  
  66. /* REALLY, WHAT'S IT DO?? */
  67. /* The code outputs the lyrics to the song The Twelve Days of Christmas, as seen below. */
  68.  
  69. /*
  70. sh-4.2$ gcc -o main *.c
  71. sh-4.2$ main
  72. On the first day of Christmas my true love gave to me
  73. a partridge in a per tree.
  74.  
  75. On the second day of Christmas my true love gave to me
  76. two turtle doves
  77. and a partridge in a per tree.
  78.  
  79. On the third day of Christmas my true love gave to me
  80. three french hens, two turtle doves
  81. and a partridge in a per tree.
  82.  
  83. On the fourth day of Christmas my true love gave to me
  84. four calling birds, three french hens, two turtle doves
  85. and a partridge in a per tree.
  86.  
  87. On the fifth day of Christmas my true love gave to me
  88. five gold rings;
  89. four calling birds, three french hens, two turtle doves
  90. and a partridge in a per tree.
  91.  
  92. On the sixth day of Christmas my true love gave to me
  93. six geese a-laying, five gold rings;
  94. four calling birds, three french hens, two turtle doves
  95. and a partridge in a per tree.
  96.  
  97. On the seventh day of Christmas my true love gave to me
  98. seven swans a-swimming,
  99. six geese a-laying, five gold rings;
  100. four calling birds, three french hens, two turtle doves
  101. and a partridge in a per tree.
  102.  
  103. On the eigth day of Christmas my true love gave to me
  104. eight maids a-milking, seven swans a-swimming,
  105. six geese a-laying, five gold rings;
  106. four calling birds, three french hens, two turtle doves
  107. and a partridge in a per tree.
  108.  
  109. On the ninth day of Christmas my true love gave to me
  110. nine ladies dancing, eight maids a-milking, seven swans a-swimming,
  111. six geese a-laying, five gold rings;
  112. four calling birds, three french hens, two turtle doves
  113. and a partridge in a per tree.
  114.  
  115. On the tenth day of Christmas my true love gave to me
  116. ten lords a-leaping,
  117. nine ladies dancing, eight maids a-milking, seven swans a-swimming,
  118. six geese a-laying, five gold rings;
  119. four calling birds, three french hens, two turtle doves
  120. and a partridge in a per tree.
  121.  
  122. On the eleventh day of Christmas my true love gave to me
  123. eleven pipers piping, ten lords a-leaping,
  124. nine ladies dancing, eight maids a-milking, seven swans a-swimming,
  125. six geese a-laying, five gold rings;
  126. four calling birds, three french hens, two turtle doves
  127. and a partridge in a per tree.
  128.  
  129. On the twelfth day of Christmas my true love gave to me
  130. twelve drummers drumming, eleven pipers piping, ten lords a-leaping,
  131. nine ladies dancing, eight maids a-milking, seven swans a-swimming,
  132. six geese a-laying, five gold rings;
  133. four calling birds, three french hens, two turtle doves
  134. and a partridge in a per tree.
  135.  
  136. sh-4.2$
  137. */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement