/* Find hash function to transform letters to punctuations. */ #include int main(int argc, char **argv) { int mul, x, mod, coverage, pass, i, o; (void)argc; (void)argv; for(mul = 1; mul < 256; mul++) { for(x = 0; x < 256; x++) { for(mod = ',' + 1; mod < 256; mod++) { coverage = 0; for(pass = 0; pass < 2; pass++) { for(i = 'J'; i <= 'S'; i++) { if( i == 'O' ) continue; o = (i * mul ^ x) % mod; if( o == ' ' ) { if( pass == 0 ) coverage |= 1; else printf("%c (%d) -> space (%d)\n", i, i, o); } else if( o == '\n' ) { if( pass == 0 ) coverage |= 2; else printf("%c (%d) -> \\n (%d)\n", i, i, o); } else if( o == '$' ) { if( pass == 0 ) coverage |= 4; else printf("%c (%d) -> $ (%d)\n", i, i, o); } else if( o == ',' ) { if( pass == 0 ) coverage |= 8; else printf("%c (%d) -> , (%d)\n", i, i, o); } else if( o == '\"' ) { if( pass == 0 ) coverage |= 16; else printf("%c (%d) -> \" (%d)\n", i, i, o); } else if( o == '#' ) { if( pass == 0 ) coverage |= 32; else printf("%c (%d) -> # (%d)\n", i, i, o); } } if( pass == 0 ) { if( coverage != 63 ) break; printf("mul = %d, x = %d, mod = %d\n", mul, x, mod); } } } } } return 0; }