class HebrewCipher:
atbash = 'ZYXWVUTSRQPONMLKJIHGFEDCBA'
albam = 'NOPQRSTUVWXYZABCDEFGHIJKLM'
atbah = 'IHGFNDCBARQPOEMLKJZYXWVUTS'
def __init__(self):
self.__plain = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
def encrypt(self, text, cipher):
''' (HebrewCipher, str, str) -> str
Retorna o texto cifrado com
a cifra hebraica escolhida
'''
txt = ''
text = text.replace(' ', '').upper()
for ch in text:
idx = self.__plain.find(ch)
txt += cipher[idx]
return txt
def decrypt(self, text, cipher):
''' (HebrewCipher, str, str) -> str
Retorna o texto decifrado com
a cifra hebraica escolhida
'''
return self.encrypt(text, cipher).lower()