class KamasutraCipher:def __init__(self):# 置换密码表,这里使用简单的示例表self.encryption_table = str.maketrans("abcdefghijklmnopqrstuvwxyz","zyxwvutsrqponmlkjihgfedcba")def encrypt(self, plaintext):# 加密函数,利用maketrans和translate实现encrypted = plaintext.lower().translate(self.encryption_table)return encrypteddef decrypt(self, ciphertext):# 解密函数,因为Kamasutra密码是自反的,所以解密和加密相同decrypted = ciphertext.lower().translate(self.encryption_table)return decrypted# 测试加解密功能if __name__ == "__main__":cipher = KamasutraCipher()# 明文消息plaintext = "Hello, World!"# 加密消息encrypted_message = cipher.encrypt(plaintext)print("加密后的消息:", encrypted_message)# 解密消息decrypted_message = cipher.decrypt(encrypted_message)print("解密后的消息:", decrypted_message)
公众号内回复 writeup 或 flag 下载公众号文章
你若喜欢,为“长弓三皮”点个赞和在看哦
推荐站内搜索:最好用的开发软件、免费开源系统、渗透测试工具云盘下载、最新渗透测试资料、最新黑客工具下载……




还没有评论,来说两句吧...