from Crypto.Cipher import AES
from Crypto.Util.Padding import unpad
import base64
# Base64编码的字符串
base64_data = "1d0KbgHFAg6tvG/pSUlIUfrN6N+5VP+XLB+FH6m/aOfAmDTzelb/77oaBKHP7fsylmvaQr4j1TB3Jn106PPAyHBZNDZWsp0Kh27BCl3Km0jBzoc2Y5LmQjZAR9pAb426"
# 解码Base64字符串
decoded_data = base64.b64decode(base64_data)
data = decoded_data
iv = bytes([57, 233, 12, 46, 56, 33, 70, 15, 47, 149, 127, 207, 122, 98, 220, 249])
key = bytes([74, 53, 219, 97, 50, 91, 239, 53, 232, 81, 58, 18, 137, 197, 11, 220])
# 创建一个AES-CBC解密器
cipher = AES.new(key, AES.MODE_CBC, iv)
# 解密数据并去除填充
try:
original_data = unpad(cipher.decrypt(data), AES.block_size)
print('Decrypted data:', original_data)
except ValueError as e:
print('Unpad error:', e)
网友评论