Source code for pycrypt.translators.numberedalphabettranslator

import translator
from .. import utils

[docs]class NumberedAlphabetTranslator(translator.Translator):
[docs] def parseInput(self, cipher): if (type(cipher) != list): return map(int, utils.split(str(cipher))) return map(int, cipher)
[docs] def translate(self, cipher): return "".join([utils.alphabet[(i % len(utils.alphabet)) - 1] for i in self.parseInput(cipher)])
[docs] def encode(self, cipher): return " ".join([str(utils.alphabet.find(i) + 1) for i in cipher.upper()])