sig
The signature:
The signature
#include <stdio.h> /*** http://www.tablespace.net ***/
int main(int argc, char *argv[]) { if(!argc) return(0);
if(argc == 1) /*** William.c ***/ return(main(0x6D696C57,
(char **)0x0A616C69L));putchar(argc); putchar((int)argv);
return ( main( argc >> 8, (char **)((int)argv >> 8)) ); }
The signature - with syntax highlighting
#include <stdio.h> /*** http://www.tablespace.net ***/
int main(int argc, char *argv[]) { if(!argc) return(0);
if(argc == 1) /*** William.c ***/ return(main(0x6D696C57,
(char **)0x0A616C69L));putchar(argc); putchar((int)argv);
return ( main( argc >> 8, (char **)((int)argv >> 8)) ); }
The signature - syntax highlighted, de-obfuscated, pointless comments removed
#include <stdio.h>
int main(int argc, char *argv[])
{
if(!argc)
return(0);
if(argc == 1)
return(main(0x6D696C57, (char **)0x0A616C69L));
putchar(argc);
putchar((int)argv);
return(main( argc >> 8, (char **)((int)argv >> 8)) );
}
What it does:
When first called, without any parameters, it recursively calls itself with "loaded" values. Each time it (recursively) runs thereafter it prints one character from each variable, and calls itself again with byte shifted values. The terminating condition is met when no characters are left.
In short, it fills up with data, prints the data while stripping it away to nothing. When no data is left, it exits.
When compiled and run, it prints "William" to stdout.
My inspiration:
RUPERT
int x=354583890;
int y=43836;
main()
{
putchar(x);
x>>=y&7;
y>>=3;
return y ? main() : 0;
}
Notes:
- I can't remember where I found "RUPERT". Probably in a sig as well.
- I thought (and still think) RUPERT is quite cool.
- My version compiles without warnings or errors. (gcc -Wall -Werror)
- I loathe globals.
- People who write Obfuscated C are some twisted individuals.