Hexadecimal English

Credit: Ninfaj on Flickr
Credit: Ninfaj on Flickr

3735928559 is a familiar number among programmers. “Really?”, you may be asking. Perhaps you’re more familiar with its hexadecimal representation, 0xDEADBEEF. It’s the sort of number you use to initialize a block of memory so that you recognize it in a debugger or somesuch. This made me wonder what other English words can be formed from hexadecimal digits:

$ grep '^[a-f]*$' /usr/share/dict/words

Meh. I quite like effaced and defaced but there’s nothing with eight characters (8 hex digits => 32-bit int). Let’s extend it a bit. We’ll allow the following numeric substitutions:

1 → i
5 → s
0 → o

i, s and o are not valid hex digits so we need to convert them to numbers. Also, everything will look more gratifying in uppercase. We can do this with standard command-line tools, no custom scripting required:

$ grep '^[a-fiso]*$' /usr/share/dict/words | sed 's/s/5/g;s/i/1/g;s/o/0/g' | tr 'a-z' 'A-Z'

That’s better. From now on, when I allocate a block of memory, I’ll initialize it to 0xBADA55ED and before freeing it, I’ll overwrite it with 0xDECEA5ED. My code has just become cooler.

Leave a Reply

Your email address will not be published. Required fields are marked *