Hacker News new | past | comments | ask | show | jobs | submit login

C code is too "random" to produce nice images. You can use the least significant bits to hold some data; Google "steganography" (this is just the most basic).



>C code is too "random" to produce nice images

In a world where it is possible to compute a file that contains its own MD5, I wouldn't bet on this. Wish I could find the link, there was some feted programmer who had a friend that bet him such a thing was not possible. He proceeded to write an algorithm that found such a file by brute force.

I wouldn't count on the eventual C being pretty though.

See also: electronic musicians hiding pictures in their music http://www.bastwood.com/?page_id=10


You're right: sane C code is too "random" to produce nice images. ;-)


One hacker's insanity is another's pastime.

http://www.de.ioccc.org/main.html


Yeah, that's what I thought of too. Has it been done yet?


Example of a python script in a bitmap:

http://www.bluh.org/codemap.bmp

Ultimately it's never going to be pretty if it's human readable as the range of bytes used will make a lot of greyish tones.

C/C++ wouldn't look a lot different I doubt, but if you want you can grab my python script (PIL required) and pack some source files and see for yourself:

http://www.github.com/mrcharles/codemap

(script has some bugs with alignment, but other than that, works)


In Java, source files can contain unicode escapes[1] of the form '\uXXXX' which are expanded prior to tokenization. In effect this gives you several options for what characters can exist in a given "pixel". I think that this, combined with careful application of whitespace and comments, should easily provide enough flexibility to make arbitrary code look roughly like a desired bitmap.

[1] http://java.sun.com/docs/books/jls/second_edition/html/lexic...


Just \uXXXX (or C trigraphs etc) doesn't give you much to play with, and I'd say that selectively tokenizing Java is cheating.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: