Python简单密码加密

img


可以帮忙看一下,关于字符替换的关于密码的加成,例如输入0012xyM输出为9987cba N

加密分为对称加密和非对称加密,如果只是简单的加密,可以使用位操作来简单的加密

https://blog.csdn.net/weixin_32918953/article/details/116222520
https://www.jb51.net/article/249037.htm
https://blog.csdn.net/zhouhua2022/article/details/124549998


num_list = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]
small = [chr(i) for i in range(97,123)] # 小写字母
big = [chr(i) for i in range(65,91)] # 大写字母

str_ = input('请输入密码:')
ret = ''
for s in str_:
    try:
        s = str(int(s))
        ret+=num_list[9-num_list.index(s)]
    except:
        if s.isupper():
            ret += big[25 - big.index(s)]
        elif s.islower():
            ret += small[25 - small.index(s)]
print(ret)