unidbg

您所在的位置:网站首页 mip指令集 unidbg

unidbg

#unidbg| 来源: 网络整理| 查看: 265

X书x-mini-sig_x-mini-mua

一切皆可逆: 麻烦博主给个demo的app链接

DES对称加密及三重DES(3DES)

Codeooo: [code=python] import base64 import binascii from Crypto.Cipher import DES from Crypto.Util.Padding import unpad,pad ciphertext = "1MpdxK203+ZrnyxuJRrYatKSBxHUIi1TSdQF2BQKXOG54plwfaB2GA==" key = "11" # 密钥长度不足8字节 # 补全密钥至8字节长度 key = key.ljust(8, "\x00").encode("utf-8") print(key) decoded_ciphertext = base64.b64decode(ciphertext) cipher = DES.new(key, DES.MODE_ECB) decrypted = cipher.decrypt(decoded_ciphertext) plaintext = unpad(decrypted, 8) plaintext = plaintext.decode("utf-8") print(plaintext) enc_string = '1MpdxK203+ZrnyxuJRrYatKSBxHUIi1TSdQF2BQKXOG54plwfaB2GA==' key = '11'.encode('utf-8') key = key + b'\0' * (8 - len(key) % 8) ## add padding a = DES.new(key, DES.MODE_ECB,) # This gives me error decrypted = a.decrypt(base64.b64decode(enc_string)) print(unpad(decrypted,8).decode()) [/code]



【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3