# encoding:utf-8
import base64
from string import maketrans
OLD_STR = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
NEW_STR = "vSoajc7dRzpWifGyNxZnV5k+DH"
def encode_demo(str_data):
str_data = base64.b64encode(str_data)
encode_tab = maketrans(OLD_STR, NEW_STR)
return str_data.translate(encode_tab)
def decode_demo(str_date):
decode_tab = maketrans(NEW_STR, OLD_STR)
str_date = str_date.translate(decode_tab)
return base64.b64decode(str_date)