Within bulletin board systems1 (BBS) in the 1980s, users having "elite" status were granted access to certain file folders, games and special chat rooms. These BBS used intelligent text filters to discourage the discussion of forbidden topics like cracking software2 or hacking computer systems and networks3. As a way to defeat those filters, the Cult of the Dear Cow4 hacker collective started using a system of modified spellings where some alphabetic characters were replaced by others in ways that play on the similarity of their glyphs via reflection or other resemblance, such as A=4 or E=3. Soon after, other hackers, crackers and script kiddies started to take over this modified spelling and called it leetspeak5 — or simply leet ("l33t" or "1337") or eleet ("3l33t" or "31337") — as a pun on the term elite. Leet has since entered the mainstream.

31337 h4x0r (elite hacker)
A 31337 h4x0r (elite hacker) laptop sticker, along with a Kevin Mitnick6 sticker.

When creating web pages, the content and the structure of the page are specified using HyperText Markup Language7 (HTML) and the layout and the design are specified using Cascading Style Sheets8 (CSS). In both cases, a color can be described by a hash (#) followed by three or six hexadecimal digits. The hexadecimal (base 16) numeral system uses sixteen distinct symbols: the symbols 0-9 to represent values zero to nine and A-F (or a-f) to represent values ten to fifteen. Because the term hexadecimal is often abbreviated to hex, the hexadecimal color notation is called hex-colors. A hex-color #h1h2h3 is a shorthand for the hex-color #h1h1h2h2h3h3. As such, hex-colors are always triplets of three hexadecimal numbers in the range 00 to FF (in hexadecimal notation) or 0 to 255 (in decimal notation).

With the slogan "The most colorful website you have ever seen!" the website bada55.io9 combines the concept hex-color with the concept leetspeak by assigning colors a name whose leetspeak spelling is equal to the hexadecimal representation of the color, except for the leading hash symbol.

BADA55
Example color names whose leetspeak notation corresponds to the hexadecimal color notation.

Assignment

The conversion of leetspeak to normal letters (and vice versa) is specified in a text file. Each line of the file consists of a leetspeak character followed by a space, the characters <->, another space and one or more letters that are replaced by the first character on the line in a conversion to leetspeak. Each line of the file has a unique first character and all letters after the symbols <-> are also unique. In determining the uniqueness, no distinction is made between uppercase and lowercase letters. However, it is possible that the same letter occurs both before and after the symbols <-> in the file. The file might then look like this.

0 <-> O
1 <-> I
2 <-> RZ
3 <-> E
5 <-> S
6 <-> G
7 <-> LTY
9 <-> P

We see, for example, that the letter E is converted to the digit 3 in leetspeak, and that the digit 7 in leetspeak might represent either the letter L or the letter T or the letter Y. Your task:

Example

In the following interactive session, we assume the text file leet.txt10 to be located in the current directory.

>>> hex2letter = leet2letter('leet.txt11')
>>> hex2letter == {'0': {'O'}, '1': {'I'}, '2': {'Z', 'R'}, '3': {'E'}, '5': {'S'}, '6': {'G'}, '7': {'L', 'Y', 'T'}, '9': {'P'}}
True

>>> letter2hex = letter2leet(hex2letter)
>>> letter2hex == {'O': '0', 'I': '1', 'Z': '2', 'R': '2', 'E': '3', 'S': '5', 'G': '6', 'L': '7', 'Y': '7', 'T': '7', 'P': '9'}
True

>>> leetspeak('BADASS', letter2hex)
'BADA55'
>>> leetspeak('fbi', letter2hex)
'FB1'
>>> leetspeak('SHRUBBERY', letter2hex)
'5H2UBB327'
>>> leetspeak('REBECCA', letter2hex)
'23B3CCA'

>>> ishexcolor('#BADA55')
True
>>> ishexcolor('#fb1')
True
>>> ishexcolor('#5H2UBB327')
False
>>> ishexcolor('#663399')
True

>>> color('BADASS', letter2hex)
'#BADA55'
>>> color('fbi', letter2hex)
'#FB1'
>>> color('SHRUBBERY', letter2hex)
Traceback (most recent call last):
AssertionError: invalid color
>>> color('REBECCA', letter2hex)
Traceback (most recent call last):
AssertionError: invalid color

Epilogue

Rebecca Meyer was taken too soon12, on her sixth birthday. Having survived rounds of treatment for cancer, the girl — one of Kathryn and Eric Meyer's three children — finally succumbed. She will be remembered through the colorful lifeblood of the web.

Rebecca Alison Meyer
Rebecca Alison Meyer (June 7, 2008 – June 7, 2014).

The death of a child is always a tragedy, and people of good will try to make sense of it through whatever means they have. Her father — Eric Meyer — is beloved among web design and development circles both for his expertise with the arcana of Cascading Style Sheets13 (CSS) used for web page layout and formatting and for the generosity, clarity and goodwill with which he shares what he knows. He has also been a force for common standards, working to keep CSS characteristics in sync across browsers made by different firms, which makes the job of designers and programmers much easier.

Eric Meyer has an engaged online presence. He was the one, for instance, to raise a hue and cry14 when a fellow web standards guru abruptly erased his presence across all websites15. (Said person was fine, just tired of living in public.) Rebecca's diagnosis, treatment, struggle and passing played out through social media as Mr Meyer turned to his broader community for moral support for him and his family.

Many of the Eric Meyers' friends, acquaintances, colleagues and well-wishers struggled to find any appropriate means to celebrate Rebecca's short life. The couple suggested two charities for donations in her name, and for those attending the memorial in person to wear the colour purple, her favourite. Few among that larger group had met Rebecca or could attend the ceremony.

Jeffrey Zeldman — a close chum and colleague of Mr Meyer — offered a broader suggestion16 to the extended community of the internet. The day of the memorial, June 12th, he proposed those who wanted to commemorate her and show the family their support use the hashtag #663399Becca. The number represents the hexadecimal (base 16) value to specify a particular shade of the color purple in the web palette. It is pictured above.

#663399Becca
Jeffrey Zeldman's call to the Internet community to commemorate Rebecca Meyer by using the hashtag #663399Becca.

On June 12th, purple abounded. The hashtag flitted about, but people on Twitter and Facebook also updated their avatars to be a solid field or purple hued, your correspondent included. Some heavily trafficked websites among the technical, design and early internet crowds — such as Daring Fireball17 and Kottke.org18 — changed backgrounds or other details to purple for the day.

But there was one more way to keep her memory alive. Web standards support specifying color values in the full range that can be expressed as a triad of three numbers, ranging from 0 to 255 in decimal or 00 to FF in hex. But they also include a small number of human-readable color names19, such as "palegoldenrod" or "crimson".

Some of the Meyers' friends and colleagues suggested that in that spirit, the colour #663399 be given the name "beccapurple." Eric Meyer, noting the honor, asked20 that if the name were adopted, it should be "rebeccapurple". Weeks before her death, she said she would give up the "baby name" of Becca and become Rebecca on her sixth birthday. She lived twelve hours with that new name. The proposal sped through the requisite groups and was approved on June 21st21. The appropriate draft document22 was updated immediately. Committee representatives from Mozilla, Apple, Google and Microsoft have already agreed to adopt the name in their browsers.

In the future, should a designer wish to choose that particular hue, the number #663399 will always suffice. But stating the value by Rebecca Meyer's full name will work as well. Not every child or person who is gone too soon can be remembered this way, but for Rebecca, it seems appropriate. Her memory is preserved not in amber, but in the color rebeccapurple.

Resources