IdolHands.com :: Days in the Life of an Alpha Geek
A while ago, I was running a memory profiler as part of a debugging effort. I was tickled to find the following English word spelled out in hexadecimal:

This was the first time that I had come across the phenomenon, but apparently this not an unusual or accidental appearance of a hex word.
According to the Wikipedia article on hexadecimal, programmers have long used DEADBEEF, CAFEBABE, 0BADFOOD, and FEEDFACE as "magic numbers" in a variety of low-level programming situations, such as using the number as a placeholder or writing it into uninitialized memory.
I was curious to find out what other words could be spelled using only hex (which, for the uninitiated, has the digits 0-9 and the letters a-f). I decided to make an allowance for the substitution of the letter "O" for the number 0, so that one of my favorite things in the world— coffee— could appear on the list as well.
I was able to write a program consisting of only a single line of Ruby code that did all of the work for me, cranking out all 202 possibilities. First, the code:
File.readlines('/usr/share/dict/words').map {|l| l.rstrip.downcase}.find_all{|w| (w.split('').sort.uniq - ["a","b","c","d","e","f","o"]).size == 0 }.uniq.each{|w| puts w.gsub("o","0") if w.size > 1}
God, I love Ruby. That code will work from any Mac OS X box, since it depends on the dictionary file at /usr/share/dict/words, but it should be adaptable to any UNIX variant.
So here's the list of all of the words that the code generated. There are 202 of them (103 if you don't include the o/0 words):
aa
ab
aba
abac
abaca
abaff
abb
abba
abe
abed
ab0
ab0de
acca
accede
ace
ad
ada
adad
add
adda
added
ade
adead
ad0
ad0be
ae
aface
affa
a0
ba
baa
bab
baba
babe
bab00
bac
bacaba
baca0
bacca
baccae
bad
bade
bae
baff
ba0bab
be
bead
beaded
bebed
bed
bedad
bedded
bedead
bedeaf
bee
beef
be0de
b0
b0a
b0b
b0ba
b0bac
b0bbed
b0b0
b0cca
b0cce
b0ce
b0d
b0de
b0d0
b00
b00b
b00d
b00f
ca
cab
caba
cabda
cab0b
caca
caca0
cad
cadd0
cade
caeca
caffa
ca0ba
ce
cede
cee
c0ab0de
c0b
c0baea
c0bbed
c0bcab
c0ca
c0ccaceae
c0cc0
c0c0
c0c0a
c0d
c0da
c0de
c0d0
c0e
c0ed
c0fe0ffee
c0ff
c0ffea
c0ffee
c00
c00ba
c00ee
c00f
da
dab
dabb
dabba
dace
dad
dada
dade
dad0
dae
daff
da0
de
dead
deaf
deb
decad
decade
dec0de
ded0
dee
deed
deedeed
deface
d0
d0ab
d0b
d0bbed
d0be
d0c
d0d
d0dd
d0dded
d0de
d0decade
d0d0
d0e
d0ff
d00b
d00dab
d00dad
ea
ebb
eb0e
ecad
ecca
ed
edda
edd0
edea
ed0
efface
fa
faba
fabaceae
facade
face
faced
fad
fade
faded
fae
faff
fe
fed
fee
feed
fe0d
fe0ff
fe0ffee
f0
f0b
f0d
f0dda
f0e
f00
f00d
0af
0be
0b0e
0d
0da
0dd
0de
0e
0f
0ff
0f0
Some of these looked funny to me, like fe0ffee, but a quick check against the (actual) dictionary enlightened me and will certainly help me out next time I play Scrabble.
![]()
Brad Gessler
January 19, 2009 at 8:22 PMNice! I didn't know about the dictionary file in X. That's going to be handy for finding domain names (its how we found conden.se)
![]()
Rufus Smith
July 30, 2009 at 12:16 PMVery cool! I would like to see the list with the inclusion of 's' (5) and 'i' (1). Also, the words may be more recognizable in uppercase-only (because of the 0) And for an additional exercise for the reader, combine words from the list to build a 4 or 8 character expression being the right size for memory fills and return codes.... like the classics DEADBEEF FEEDFACE FOODDOOD
![]()
Richard
August 19, 2009 at 3:46 AMHi -- nice article. Why not allow 1 as well as 0 (and map to letter I) to allow a wider choice of words?
![]()
neuronsong
February 25, 2010 at 10:09 PMAdding the 'i' -> '1' and 's' -> '5' is so easy. File.readlines('/usr/share/dict/words').map { |l| l.rstrip.downcase}.find_all{ |w| (w.split('').sort.uniq - ['a','b','c','d','e','f','i','o','s']).size == 0 }.uniq.each { |w| puts w.gsub('o','0').gsub('i','1').gsub('s','5') if w.size > 1} I'm sure there is probably a cleaner way to do the gsubs. This works just fine, however. Ruby is, indeed, quite nice.
![]()
JohnDiego
April 2, 2010 at 3:40 PM7 is a fair substitute for T, as in 700BAD 700FADED