期中考核复现

 Crypto

1z_AES

import base64
from Crypto.Cipher import AES
from flag import getflag()

iv = '1229002675654321'
key = 'yunxiexamcrypto3'
data = getflag()

def pad(data):
    pad_data = data
    for i in range(0, 16 - len(data)):
        pad_data = pad_data + ' '
    return pad_data

def AES_en(key, data):
    if len(data) < 16:
        data = pad(data)
    AES_obj = AES.new(key.encode("utf-8"), AES.MODE_CBC, iv.encode("utf-8"))
    AES_en_str = AES_obj.encrypt(data.encode("utf-8"))
    AES_en_str = base64.b64encode(AES_en_str)
    AES_en_str = AES_en_str.decode("utf-8")
    return AES_en_str

data = AES_en(key, data)
print(data)
#data=5UXnsxhmLldM4GAcU//vsqf6xICtgtM12fFPrYikBrU=

 找在线工具解密:AES在线解密 AES在线加密 Aes online hex 十六进制密钥 - The X 在线工具

期中考核复现_第1张图片

 Yunxi{407332d77ad5e911499f4114c17897fd}

你可能感兴趣的:(前端)