codext defines a few steganography-related encodings. While encoding is not really steganography (that is, concealing data within data), the following codecs are worth creating this category as they relate to converting data into something that could mislead the unaware reader.

Klopf Code

This is a Polybius code with the trivial alphabetical distribution ("A" -> (1,1), "B" -> (2,1), ...). This can be tested here.

Codec Conversions Aliases Comment
klopf text <-> klopf encoded text klopfcode
>>> codext.encode("this is a test", "klopf")
'44324234 4234 11 44513444'
>>> codext.decode("44324234 4234 11 44513444", "klopf")

Resistor Color Codes

This uses the electronic color code to encode digits, displaying colors in the terminal with ANSI color codes.

Codec Conversions Aliases Comment
resistor text <-> resistor colors condensator, resistors-color, resistor_color_code visually, it only works in a terminal supporting ANSI color codes
>>> codext.encode("1234", "resistor")
'\x1b[48;5;130m \x1b[0;00m\x1b[48;5;1m \x1b[0;00m\x1b[48;5;214m \x1b[0;00m\x1b[48;5;11m \x1b[0;00m'
>>> codext.decode("\x1b[48;5;130m \x1b[0;00m\x1b[48;5;1m \x1b[0;00m\x1b[48;5;214m \x1b[0;00m\x1b[48;5;11m \x1b[0;00m", "condensators_color")

SMS (T9)

This codec implements the SMS encoding, also caled T9, that is the conversion from characters to their corresponding phone keystrokes.

Codec Conversions Aliases Comment
sms text <-> phone keystrokes nokia, nokia_3310, t9 uses "-" as a separator for encoding, "-" or "_" or whitespace for decoding
>>> codext.encode("this is a test", "sms")
>>> codext.decode("8_44_444_7777_0_444_7777_0_2_0_8_33_7777_8", "nokia")
'this is a test'
>>> codext.decode("8_44_444_7777_0-444-7777_0-2_0_8_33-7777-8", "t9")
'this is a test'


This simple encoding replaces zeros and ones of the binary version of the input text with spaces and tabs. It is supported either with its original mapping or with the inverted mapping.

Encoding, not programming !

This should not be confused with the whitespace esoteric language.

Codec Conversions Aliases Comment
whitespace text <-> whitespaces and tabs whitespaces?-inv(erted)? The default encoding uses tabs for zeros and spaces for ones
whitespace_after_before text <-> whitespaces[letter]whitespaces This codec encodes characters as new characters with whitespaces before and after according to an equation described in the codec name (e.g. "whitespace+2*after-3*before")
>>> codext.encode("test", "whitespace")
'\t   \t \t\t\t  \t\t \t \t   \t\t  \t   \t \t\t'
>>> codext.encode("test", "whitespaces")
'\t   \t \t\t\t  \t\t \t \t   \t\t  \t   \t \t\t'
>>> codext.encode("test", "whitespaces-inv")
' \t\t\t \t   \t\t  \t \t \t\t\t  \t\t \t\t\t \t  '
>>> codext.decode(" \t\t\t \t   \t\t  \t \t \t\t\t  \t\t \t\t\t \t  ", "whitespaces_inverted")
>>> codext.encode("test", "whitespace+after-before")
'             m      \n        l               \n   u     \n            m     '
>>> codext.decode("             m      \n        l               \n   u     \n            m     ", "whitespace+after-before")