# -*- coding: utf-8 -*-

import random
import string


fromstr = '0123456789#'
tostr = 'RKxyjwzcs6U'


def generate_tostr(n):
    fromstrlist = list(string.letters + string.digits)
    random.shuffle(fromstrlist)
    return ''.join(fromstrlist)[:n]


def caesar_encrypt(plaintext):
    return str(plaintext).translate(string.maketrans(fromstr, tostr))


def caesar_decrypt(ciphertext):
    return str(ciphertext).translate(string.maketrans(tostr, fromstr))
