DEV Community

Cover image for Congressional District-based Encoding
Jason Steinhauser
Jason Steinhauser

Posted on

Congressional District-based Encoding

Note: this project has no political basis. I did this just because I thought it would be funny.

My Twitter-verse was all aflutter this late last week due to the release of a typeface based on gerrymandering. Neutral of its possible perceived political implications, I thought this was hysterical, and that it warranted having its own encoding.

Introducing Gerry Cipher!

Gerry Cipher is basically translating Base64 encoding into congressional districts. This was interesting in a couple of regards:

  • Some letters were formed by combining two districts
  • M and W were the same district, just mirrored
  • There were no districts provided for numerals

To address converting the district-based encodings to upper-/lowercase letters, it was fairly trivial: if a letter was comprised of one district, the uppercase encoding had uppercase letters, and likewise for lowercase. If the letter was a composite, then the left/upper district was the uppercase encoding, and the right/bottom district was the lowercase encoding. In the case of M/W being mirrored (NY's 8th district), the encodings are mirrored (NY08/80YN and ny08/80yn for M/W and m/w).

Addressing numerals was something not covered by the Ugly Gerry typeface. To this effect, I used the ten largest congressional districts by area. Since I was using Base64 encoding as a basis, there was the matter of handling + and /. I determined that the two longest-running non-voting delegations would be used - Puerto Rico (PR01) and Washington D.C. (DC01).

What's Next?

It's just a silly little project, and I may or may not translate it to other languages just to propagate the silliness. I will code up... er... decoding... soon as well. I welcome you to check it out!

Happy coding!

Top comments (0)