# https://blog.csdn.net/weixin_45254208/article/details/107702590?spm=1001.2101.3001.6650.3&utm_medium=distribute.pc_relevant.none-task-blog-2%7Edefault%7EBlogCommendFromBaidu%7ERate-3-107702590-blog-111424522.235%5Ev43%5Epc_blog_bottom_relevance_base3&depth_1-utm_source=distribute.pc_relevant.none-task-blog-2%7Edefault%7EBlogCommendFromBaidu%7ERate-3-107702590-blog-111424522.235%5Ev43%5Epc_blog_bottom_relevance_base3&utm_relevant_index=6
def shift_encrypt(m, key):
l =len(key)
c =""
? ? for iin range(0, len(m), l):
tmp_c = [""] * l
if i+l >len(m):
tmp_m = m[i:]
else:
tmp_m = m[i:i+l]
for jin range(len(tmp_m)):
tmp_c[int(key[j]) -1] = tmp_m[j]
c +="".join(tmp_c)
return c
m ="011618091208010409142215122113052116061815130914130125200801201901141421011209260504071815232008"
key ="3124"
print(shift_encrypt(m, key))