ciphers.porta_cipher

Attributes

alphabet

key

Functions

decrypt(→ str)

encrypt(→ str)

generate_table(→ list[tuple[str, str]])

get_opponent(→ str)

get_position(→ tuple[int, int])

Module Contents

ciphers.porta_cipher.decrypt(key: str, words: str) str
>>> decrypt('marvin', 'QRACRWU')
'JESSICA'
ciphers.porta_cipher.encrypt(key: str, words: str) str
>>> encrypt('marvin', 'jessica')
'QRACRWU'
ciphers.porta_cipher.generate_table(key: str) list[tuple[str, str]]
>>> generate_table('marvin')  
[('ABCDEFGHIJKLM', 'UVWXYZNOPQRST'), ('ABCDEFGHIJKLM', 'NOPQRSTUVWXYZ'),
 ('ABCDEFGHIJKLM', 'STUVWXYZNOPQR'), ('ABCDEFGHIJKLM', 'QRSTUVWXYZNOP'),
 ('ABCDEFGHIJKLM', 'WXYZNOPQRSTUV'), ('ABCDEFGHIJKLM', 'UVWXYZNOPQRST')]
ciphers.porta_cipher.get_opponent(table: tuple[str, str], char: str) str
>>> get_opponent(generate_table('marvin')[0], 'M')
'T'
ciphers.porta_cipher.get_position(table: tuple[str, str], char: str) tuple[int, int]
>>> get_position(generate_table('marvin')[0], 'M')
(0, 12)
ciphers.porta_cipher.alphabet
ciphers.porta_cipher.key