This is just for lulz.
- Take a character string (ASCII8, no character >242).
- Transform each byte into a sequence of 5 trinary digits (i.e. from
00000
to22222
). - Concatenate all trinary digits (i.e. a long sequence of
0
,1
, and2
). - Add extra
0
s at the end so that the total length is divisible by 3. - Break down by groups of 3.
- Transform each group of 3 into an integer, ranging from 0 to 26.
- Map 0 to
-
, and 1 to 26 toA
toZ
. - Concatenate the result.
Example:
encode('Hello, world!')
'HAFV-LAJAQCPLVCLSICSCR'