rot13解密脚本

def Upper(ch):
    if ch >= 'A' and ch <= 'Z':
        return True


def Lower(ch):
    if ch >= 'a' and ch <= 'z':
        return True


def rot13(s):
    flag = ''
    for i in s:
        if Upper(i) == True:
            if i >= 'A' and i <= 'M':
                flag += chr(ord(i) + 13)
            else:
                flag += chr(ord(i) - 13)
        elif Lower(i) == True:
            if i >= 'a' and i <= 'm':
                flag += chr(ord(i) + 13)
            else:
                flag += chr(ord(i) - 13)
        else:
            flag += i
    return flag


if __name__ == "__main__":
    s = 'EzkuM0yGAzA2n3WbEaOJEHuOFmuOpN=='  #被rot13加密的密文
    print (rot13(s))

转载于:https://blog.csdn.net/kevin66654/article/details/55195086

发布了148 篇原创文章 · 获赞 61 · 访问量 6万+

猜你喜欢

转载自blog.csdn.net/qq_41617034/article/details/104701204
今日推荐