Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在努力将 Java 程序转换为 Python,其核心网络的一部分使用 AES 加密来处理上下线的数据包。Java 的 AES 初始化如下:
byte[] key = { 0x13, 0x00, 0x00, 0x00 }; sKeySpec = new SecretKeySpec(key, "AES");
我想在 Python 中做同样的事情,并将使用 PyCrypto,但我不确定如何在其中初始化上述内容,因为它只允许基于字符串的“密钥”。
然后使用字符串
key = '\x13\x00\x00\x00'
为什么不尝试使用 Jython,因为您可以直接导入 .class 文件而无需重新编写它。