ciphers.baconian_cipher

Program to encode and decode Baconian or Bacon’s Cipher Wikipedia reference : https://en.wikipedia.org/wiki/Bacon%27s_cipher

Attributes

decode_dict

encode_dict

Functions

decode(→ str)

Decodes from Baconian cipher

encode(→ str)

Encodes to Baconian cipher

Module Contents

ciphers.baconian_cipher.decode(coded: str) str

Decodes from Baconian cipher

>>> decode("AABBBAABAAABABAABABAABBAB BABAAABBABBAAAAABABAAAABB")
'hello world'
>>> decode("AABBBAABAAABABAABABAABBAB")
'hello'
>>> decode("AABBBAABAAABABAABABAABBAB BABAAABBABBAAAAABABAAAABB!")
Traceback (most recent call last):
    ...
Exception: decode() accepts only 'A', 'B' and spaces
ciphers.baconian_cipher.encode(word: str) str

Encodes to Baconian cipher

>>> encode("hello")
'AABBBAABAAABABAABABAABBAB'
>>> encode("hello world")
'AABBBAABAAABABAABABAABBAB BABAAABBABBAAAAABABAAAABB'
>>> encode("hello world!")
Traceback (most recent call last):
    ...
Exception: encode() accepts only letters of the alphabet and spaces
ciphers.baconian_cipher.decode_dict
ciphers.baconian_cipher.encode_dict