【发布时间】:2022-01-16 17:16:45
【问题描述】:
我尝试在我的机器上同时使用 python 和 python3 运行这段代码,但它有很多错误,例如:
python3 gen.py
Traceback (most recent call last):
File "/home/kali/Downloads/gen.py", line 1, in <module>
from crypto.Cipher import DES
ModuleNotFoundError: No module named 'crypto'
python gen.py
Traceback (most recent call last):
File "gen.py", line 1, in <module>
from Crypto.Cipher import DES
ImportError: No module named Crypto.Cipher
from Crypto.Cipher import DES
import binascii
key = open('key').read()
iv = '55531056'
cipher = DES.new(key, DES.MODE_OFB, iv)
plaintext = open('plain.txt').read()
msg = iv + cipher.encrypt(plaintext)
with open('flag.enc', 'w') as f:
f.write(msg)
【问题讨论】:
标签: python python-3.x cryptography pycrypto pycryptodome