Skip to content

Instantly share code, notes, and snippets.

@stonegray
Last active October 17, 2016 23:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stonegray/8e88875b1e6fa5d6cb2894138f34fde2 to your computer and use it in GitHub Desktop.
Save stonegray/8e88875b1e6fa5d6cb2894138f34fde2 to your computer and use it in GitHub Desktop.
Obfuscated C Practice: Month to Integer
// Month name to month integer.
// Input a lowercase month name
#include <stdio.h>
int main(int argc, char *argv[]){
if (argc != 2) return 1;
const int __ = 0b1;
const int x_ = 0b11;
const int _x=x_+ 0b111;
char _[42]="\0\0LCPHGDOCTCRTOC[LWPLWNCWIUGRQEVPQXFGEmx\0";
while(1){
if( (*(x_-__+_+(*(_))+(*(_+__)*(x_)))+_x*(x_)==*(*(__+argv)+(*(_))++))&&
(*(x_-__+_+(*(_))+(*(_+__)*(x_)))+_x*(x_)==*(*(__+argv)+(*(_))++))&&
(*(x_-__+_+(*(_))+(*(_+__)*(x_)))+_x*(x_)==*(*(__+argv)+(*(_))++))){
printf("Month %u\n",*(_+__)+__);
break;
}
if(!((*(_+__))++<_x+(x_-__))||((*(_))=(__>_x))){
printf("Not a month!\n");
break;
}
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment